Skip to content

Commit c7f876b

Browse files
leeightBethGriggs
authored andcommitted
http2: fix session[kSession] undefined issue
`finishSessionDestroy` session cleanup when already done. PR-URL: #24547Fixes: #24546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent ec70330 commit c7f876b

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎lib/internal/http2/core.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,6 +1996,7 @@ class Http2Stream extends Duplex {
19961996
// attempt to gracefully close the session.
19971997
conststate=this[kState];
19981998
if(this.headersSent&&
1999+
this[kSession]&&
19992000
this[kSession][kType]===NGHTTP2_SESSION_SERVER&&
20002001
!(state.flags&STREAM_FLAGS_HAS_TRAILERS)&&
20012002
!state.didRead&&
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
constcommon=require('../common');
4+
if(!common.hasCrypto)
5+
common.skip('missing crypto');
6+
consth2=require('http2');
7+
8+
constserver=h2.createServer();
9+
server.listen(0,common.localhostIPv4,common.mustCall(()=>{
10+
constafterConnect=common.mustCall((session)=>{
11+
session.request({':method': 'POST'}).end(common.mustCall(()=>{
12+
session.destroy();
13+
server.close();
14+
}));
15+
});
16+
17+
constport=server.address().port;
18+
consthost=common.localhostIPv4;
19+
h2.connect('http://'+host+':'+port,afterConnect);
20+
}));

0 commit comments

Comments
 (0)