@@ -186,6 +186,7 @@ const { _connectionListener: httpConnectionListener } = http;
186186
187187const dc = require ( 'diagnostics_channel' ) ;
188188const onClientStreamCreatedChannel = dc . channel ( 'http2.client.stream.created' ) ;
189+ const onClientStreamStartChannel = dc . channel ( 'http2.client.stream.start' ) ;
189190
190191let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'http2' , ( fn ) => {
191192 debug = fn ;
@@ -381,6 +382,12 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) {
381382 headers : obj ,
382383 } ) ;
383384 }
385+ if ( onClientStreamStartChannel . hasSubscribers ) {
386+ onClientStreamStartChannel . publish ( {
387+ stream,
388+ headers : obj ,
389+ } ) ;
390+ }
384391 if ( endOfStream ) {
385392 stream . push ( null ) ;
386393 }
@@ -717,7 +724,7 @@ function onGoawayData(code, lastStreamID, buf) {
717724// When a ClientHttp2Session is first created, the socket may not yet be
718725// connected. If request() is called during this time, the actual request
719726// will be deferred until the socket is ready to go.
720- function requestOnConnect ( headers , options ) {
727+ function requestOnConnect ( headersList , headersParam , options ) {
721728 const session = this [ kSession ] ;
722729
723730 // At this point, the stream should have already been destroyed during
@@ -744,7 +751,7 @@ function requestOnConnect(headers, options) {
744751
745752 // `ret` will be either the reserved stream ID (if positive)
746753 // or an error code (if negative)
747- const ret = session [ kHandle ] . request ( headers ,
754+ const ret = session [ kHandle ] . request ( headersList ,
748755 streamOptions ,
749756 options . parent | 0 ,
750757 options . weight | 0 ,
@@ -776,6 +783,12 @@ function requestOnConnect(headers, options) {
776783 return ;
777784 }
778785 this [ kInit ] ( ret . id ( ) , ret ) ;
786+ if ( onClientStreamStartChannel . hasSubscribers ) {
787+ onClientStreamStartChannel . publish ( {
788+ stream : this ,
789+ headers : headersParam ,
790+ } ) ;
791+ }
779792}
780793
781794// Validates that priority options are correct, specifically:
@@ -1859,7 +1872,7 @@ class ClientHttp2Session extends Http2Session {
18591872 }
18601873 }
18611874
1862- const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , options ) ) ;
1875+ const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , headersParam , options ) ) ;
18631876 if ( this . connecting ) {
18641877 if ( this [ kPendingRequestCalls ] !== null ) {
18651878 this [ kPendingRequestCalls ] . push ( onConnect ) ;
0 commit comments