★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/091238a9a7Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files

http2: fix session[kSession] undefined issue

`finishSessionDestroy` session cleanup when already done.

PR-URL: #24547
Fixes: #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>
  • Loading branch information...
leeight authored and rvagg committed Nov 21, 2018
1 parent cd1aa2b commit 091238a9a74f342eef12dcaa962cda80319dcfb7
Showing with 21 additions and 0 deletions.
  1. +1 −0 lib/internal/http2/core.js
  2. +20 −0 test/parallel/test-http2-server-session-destroy.js
@@ -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 &&
@@ -0,0 +1,20 @@
'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.localhostIPv4, common.mustCall(() => {
const afterConnect = common.mustCall((session) => {
session.request({ ':method': 'POST' }).end(common.mustCall(() => {
session.destroy();
server.close();
}));
});

const port = server.address().port;
const host = common.localhostIPv4;
h2.connect('http://' + host + ':' + port, afterConnect);
}));

0 comments on commit 091238a

Please sign in to comment.
You can’t perform that action at this time.