@@ -74,6 +74,7 @@ const kEncrypted = Symbol('encrypted');
74
74
const kHandle = Symbol ( 'handle' ) ;
75
75
const kID = Symbol ( 'id' ) ;
76
76
const kInit = Symbol ( 'init' ) ;
77
+ const kInfoHeaders = Symbol ( 'sent-info-headers' ) ;
77
78
const kMaybeDestroy = Symbol ( 'maybe-destroy' ) ;
78
79
const kLocalSettings = Symbol ( 'local-settings' ) ;
79
80
const kOptions = Symbol ( 'options' ) ;
@@ -82,6 +83,8 @@ const kProceed = Symbol('proceed');
82
83
const kProtocol = Symbol ( 'protocol' ) ;
83
84
const kProxySocket = Symbol ( 'proxy-socket' ) ;
84
85
const kRemoteSettings = Symbol ( 'remote-settings' ) ;
86
+ const kSentHeaders = Symbol ( 'sent-headers' ) ;
87
+ const kSentTrailers = Symbol ( 'sent-trailers' ) ;
85
88
const kServer = Symbol ( 'server' ) ;
86
89
const kSession = Symbol ( 'session' ) ;
87
90
const kState = Symbol ( 'state' ) ;
@@ -256,6 +259,7 @@ function onStreamTrailers() {
256
259
stream . destroy ( headersList ) ;
257
260
return [ ] ;
258
261
}
262
+ stream [ kSentTrailers ] = trailers ;
259
263
return headersList ;
260
264
}
261
265
@@ -1344,6 +1348,7 @@ class ClientHttp2Session extends Http2Session {
1344
1348
throw headersList ;
1345
1349
1346
1350
const stream = new ClientHttp2Stream ( this , undefined , undefined , { } ) ;
1351
+ stream [ kSentHeaders ] = headers ;
1347
1352
1348
1353
// Close the writable side of the stream if options.endStream is set.
1349
1354
if ( options . endStream )
@@ -1507,6 +1512,18 @@ class Http2Stream extends Duplex {
1507
1512
return `Http2Stream ${ util . format ( obj ) } ` ;
1508
1513
}
1509
1514
1515
+ get sentHeaders ( ) {
1516
+ return this [ kSentHeaders ] ;
1517
+ }
1518
+
1519
+ get sentTrailers ( ) {
1520
+ return this [ kSentTrailers ] ;
1521
+ }
1522
+
1523
+ get sentInfoHeaders ( ) {
1524
+ return this [ kInfoHeaders ] ;
1525
+ }
1526
+
1510
1527
get pending ( ) {
1511
1528
return this [ kID ] === undefined ;
1512
1529
}
@@ -1846,6 +1863,7 @@ function processRespondWithFD(self, fd, headers, offset = 0, length = -1,
1846
1863
state . flags |= STREAM_FLAGS_HEADERS_SENT ;
1847
1864
1848
1865
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
1866
+ self [ kSentHeaders ] = headers ;
1849
1867
if ( ! Array . isArray ( headersList ) ) {
1850
1868
self . destroy ( headersList ) ;
1851
1869
return ;
@@ -2076,6 +2094,7 @@ class ServerHttp2Stream extends Http2Stream {
2076
2094
2077
2095
const id = ret . id ( ) ;
2078
2096
const stream = new ServerHttp2Stream ( session , ret , id , options , headers ) ;
2097
+ stream [ kSentHeaders ] = headers ;
2079
2098
2080
2099
if ( options . endStream )
2081
2100
stream . end ( ) ;
@@ -2135,6 +2154,7 @@ class ServerHttp2Stream extends Http2Stream {
2135
2154
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
2136
2155
if ( ! Array . isArray ( headersList ) )
2137
2156
throw headersList ;
2157
+ this [ kSentHeaders ] = headers ;
2138
2158
2139
2159
state . flags |= STREAM_FLAGS_HEADERS_SENT ;
2140
2160
@@ -2320,6 +2340,10 @@ class ServerHttp2Stream extends Http2Stream {
2320
2340
const headersList = mapToHeaders ( headers , assertValidPseudoHeaderResponse ) ;
2321
2341
if ( ! Array . isArray ( headersList ) )
2322
2342
throw headersList ;
2343
+ if ( ! this [ kInfoHeaders ] )
2344
+ this [ kInfoHeaders ] = [ headers ] ;
2345
+ else
2346
+ this [ kInfoHeaders ] . push ( headers ) ;
2323
2347
2324
2348
const ret = this [ kHandle ] . info ( headersList ) ;
2325
2349
if ( ret < 0 )
0 commit comments