@@ -186,6 +186,7 @@ const { _connectionListener: httpConnectionListener } = http;
186
186
187
187
const dc = require ( 'diagnostics_channel' ) ;
188
188
const onClientStreamCreatedChannel = dc . channel ( 'http2.client.stream.created' ) ;
189
+ const onClientStreamStartChannel = dc . channel ( 'http2.client.stream.start' ) ;
189
190
190
191
let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'http2' , ( fn ) => {
191
192
debug = fn ;
@@ -381,6 +382,12 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) {
381
382
headers : obj ,
382
383
} ) ;
383
384
}
385
+ if ( onClientStreamStartChannel . hasSubscribers ) {
386
+ onClientStreamStartChannel . publish ( {
387
+ stream,
388
+ headers : obj ,
389
+ } ) ;
390
+ }
384
391
if ( endOfStream ) {
385
392
stream . push ( null ) ;
386
393
}
@@ -717,7 +724,7 @@ function onGoawayData(code, lastStreamID, buf) {
717
724
// When a ClientHttp2Session is first created, the socket may not yet be
718
725
// connected. If request() is called during this time, the actual request
719
726
// will be deferred until the socket is ready to go.
720
- function requestOnConnect ( headers , options ) {
727
+ function requestOnConnect ( headersList , headersParam , options ) {
721
728
const session = this [ kSession ] ;
722
729
723
730
// At this point, the stream should have already been destroyed during
@@ -744,7 +751,7 @@ function requestOnConnect(headers, options) {
744
751
745
752
// `ret` will be either the reserved stream ID (if positive)
746
753
// or an error code (if negative)
747
- const ret = session [ kHandle ] . request ( headers ,
754
+ const ret = session [ kHandle ] . request ( headersList ,
748
755
streamOptions ,
749
756
options . parent | 0 ,
750
757
options . weight | 0 ,
@@ -776,6 +783,12 @@ function requestOnConnect(headers, options) {
776
783
return ;
777
784
}
778
785
this [ kInit ] ( ret . id ( ) , ret ) ;
786
+ if ( onClientStreamStartChannel . hasSubscribers ) {
787
+ onClientStreamStartChannel . publish ( {
788
+ stream : this ,
789
+ headers : headersParam ,
790
+ } ) ;
791
+ }
779
792
}
780
793
781
794
// Validates that priority options are correct, specifically:
@@ -1859,7 +1872,7 @@ class ClientHttp2Session extends Http2Session {
1859
1872
}
1860
1873
}
1861
1874
1862
- const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , options ) ) ;
1875
+ const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , headersParam , options ) ) ;
1863
1876
if ( this . connecting ) {
1864
1877
if ( this [ kPendingRequestCalls ] !== null ) {
1865
1878
this [ kPendingRequestCalls ] . push ( onConnect ) ;
0 commit comments