@@ -191,6 +191,7 @@ const { _connectionListener: httpConnectionListener } = http;
191191
192192const dc = require ( 'diagnostics_channel' ) ;
193193const onClientStreamCreatedChannel = dc . channel ( 'http2.client.stream.created' ) ;
194+ const onClientStreamStartChannel = dc . channel ( 'http2.client.stream.start' ) ;
194195
195196let debug = require ( 'internal/util/debuglog' ) . debuglog ( 'http2' , ( fn ) => {
196197 debug = fn ;
@@ -389,6 +390,12 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) {
389390 headers : obj ,
390391 } ) ;
391392 }
393+ if ( onClientStreamStartChannel . hasSubscribers ) {
394+ onClientStreamStartChannel . publish ( {
395+ stream,
396+ headers : obj ,
397+ } ) ;
398+ }
392399 if ( endOfStream ) {
393400 stream . push ( null ) ;
394401 }
@@ -725,7 +732,7 @@ function onGoawayData(code, lastStreamID, buf) {
725732// When a ClientHttp2Session is first created, the socket may not yet be
726733// connected. If request() is called during this time, the actual request
727734// will be deferred until the socket is ready to go.
728- function requestOnConnect ( headers , options ) {
735+ function requestOnConnect ( headersList , headersParam , options ) {
729736 const session = this [ kSession ] ;
730737
731738 // At this point, the stream should have already been destroyed during
@@ -752,7 +759,7 @@ function requestOnConnect(headers, options) {
752759
753760 // `ret` will be either the reserved stream ID (if positive)
754761 // or an error code (if negative)
755- const ret = session [ kHandle ] . request ( headers ,
762+ const ret = session [ kHandle ] . request ( headersList ,
756763 streamOptions ,
757764 options . parent | 0 ,
758765 options . weight | 0 ,
@@ -784,6 +791,12 @@ function requestOnConnect(headers, options) {
784791 return ;
785792 }
786793 this [ kInit ] ( ret . id ( ) , ret ) ;
794+ if ( onClientStreamStartChannel . hasSubscribers ) {
795+ onClientStreamStartChannel . publish ( {
796+ stream : this ,
797+ headers : headersParam ,
798+ } ) ;
799+ }
787800}
788801
789802// Validates that priority options are correct, specifically:
@@ -1861,7 +1874,7 @@ class ClientHttp2Session extends Http2Session {
18611874 }
18621875 }
18631876
1864- const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , options ) ) ;
1877+ const onConnect = reqAsync . bind ( requestOnConnect . bind ( stream , headersList , headersParam , options ) ) ;
18651878 if ( this . connecting ) {
18661879 if ( this [ kPendingRequestCalls ] !== null ) {
18671880 this [ kPendingRequestCalls ] . push ( onConnect ) ;
0 commit comments