Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
http2: fix session[kSession] undefined issue
`finishSessionDestroy` already done session cleaning up.

Fix: #24546
  • Loading branch information
leeight committed Nov 22, 2018
commit 8e5e01cd8a8ca1962625dd041b9cfb39370085b3
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,7 @@ class Http2Stream extends Duplex {
// attempt to gracefully close the session.
const state = this[kState];
if (this.headersSent &&
this[kSession] &&
this[kSession][kType] === NGHTTP2_SESSION_SERVER &&
!(state.flags & STREAM_FLAGS_HAS_TRAILERS) &&
!state.didRead &&
Expand Down
16 changes: 16 additions & 0 deletions test/parallel/test-http2-server-session-destroy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const h2 = require('http2');

const server = h2.createServer();
server.listen(0, common.mustCall(() => {
h2.connect(`http://localhost:${server.address().port}`, (session) => {
Comment thread
leeight marked this conversation as resolved.
Outdated
session.request({ ':method': 'POST' }).end(common.mustCall(() => {
session.destroy();
server.close();
}));
});
}));