@@ -76,6 +76,7 @@ const kEncrypted = Symbol('encrypted');
76
76
const kHandle = Symbol ( 'handle' ) ;
77
77
const kID = Symbol ( 'id' ) ;
78
78
const kInit = Symbol ( 'init' ) ;
79
+ const kInfoHeaders = Symbol ( 'sent-info-headers' ) ;
79
80
const kMaybeDestroy = Symbol ( 'maybe-destroy' ) ;
80
81
const kLocalSettings = Symbol ( 'local-settings' ) ;
81
82
const kOptions = Symbol ( 'options' ) ;
@@ -84,6 +85,8 @@ const kProceed = Symbol('proceed');
84
85
const kProtocol = Symbol ( 'protocol' ) ;
85
86
const kProxySocket = Symbol ( 'proxy-socket' ) ;
86
87
const kRemoteSettings = Symbol ( 'remote-settings' ) ;
88
+ const kSentHeaders = Symbol ( 'sent-headers' ) ;
89
+ const kSentTrailers = Symbol ( 'sent-trailers' ) ;
87
90
const kServer = Symbol ( 'server' ) ;
88
91
const kSession = Symbol ( 'session' ) ;
89
92
const kState = Symbol ( 'state' ) ;
@@ -258,6 +261,7 @@ function onStreamTrailers() {
258
261
stream . destroy ( headersList ) ;
259
262
return [ ] ;
260
263
}
264
+ stream [ kSentTrailers ] = trailers ;
261
265
return headersList ;
262
266
}
263
267
@@ -1348,6 +1352,7 @@ class ClientHttp2Session extends Http2Session {
1348
1352
throw headersList ;
1349
1353
1350
1354
const stream = new ClientHttp2Stream ( this , undefined , undefined , { } ) ;
1355
+ stream [ kSentHeaders ] = headers ;
1351
1356
1352
1357
// Close the writable side of the stream if options.endStream is set.
1353
1358
if ( options . endStream )
@@ -1514,6 +1519,18 @@ class Http2Stream extends Duplex {
1514
1519
return `Http2Stream ${ util . format ( obj ) } ` ;
1515
1520
}
1516
1521
1522
+ get sentHeaders ( ) {
1523
+ return this [ kSentHeaders ] ;
1524
+ }
1525
+
1526
+ get sentTrailers ( ) {
1527
+ return this [ kSentTrailers ] ;
1528
+ }
1529
+
1530
+ get sentInfoHeaders ( ) {
1531
+ return this [ kInfoHeaders ] ;
1532
+ }
1533
+
1517
1534
get pending ( ) {
1518
1535
return this [ kID ] === undefined ;
1519
1536
}
@@ -1855,6 +1872,7 @@ function processRespondWithFD(self, fd, headers, offset = 0, length = -1,
1855
1872
state . flags |= STREAM_FLAGS_HEADERS_SENT ;
1856
1873
1857
1874
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
1875
+ self [ kSentHeaders ] = headers ;
1858
1876
if ( ! Array . isArray ( headersList ) ) {
1859
1877
self . destroy ( headersList ) ;
1860
1878
return ;
@@ -2085,6 +2103,7 @@ class ServerHttp2Stream extends Http2Stream {
2085
2103
2086
2104
const id = ret . id ( ) ;
2087
2105
const stream = new ServerHttp2Stream ( session , ret , id , options , headers ) ;
2106
+ stream [ kSentHeaders ] = headers ;
2088
2107
2089
2108
if ( options . endStream )
2090
2109
stream . end ( ) ;
@@ -2144,6 +2163,7 @@ class ServerHttp2Stream extends Http2Stream {
2144
2163
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
2145
2164
if ( ! Array . isArray ( headersList ) )
2146
2165
throw headersList ;
2166
+ this [ kSentHeaders ] = headers ;
2147
2167
2148
2168
state . flags |= STREAM_FLAGS_HEADERS_SENT ;
2149
2169
@@ -2329,6 +2349,10 @@ class ServerHttp2Stream extends Http2Stream {
2329
2349
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
2330
2350
if ( ! Array . isArray ( headersList ) )
2331
2351
throw headersList ;
2352
+ if ( ! this [ kInfoHeaders ] )
2353
+ this [ kInfoHeaders ] = [ headers ] ;
2354
+ else
2355
+ this [ kInfoHeaders ] . push ( headers ) ;
2332
2356
2333
2357
const ret = this [ kHandle ] . info ( headersList ) ;
2334
2358
if ( ret < 0 )
0 commit comments