Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7620d1

Browse filesBrowse files
ywave620danielleadams
authored andcommitted
src,http2: ensure cleanup if a frame is not sent
Call to JS and close the session if a frame is not sent even there is no frameError listener registered by user. PR-URL: #47244 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 53d9eb5 commit a7620d1
Copy full SHA for a7620d1

File tree

Expand file treeCollapse file tree

2 files changed

+39
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+39
-2
lines changed
Open diff view settings
Collapse file

‎src/node_http2.cc‎

Copy file name to clipboardExpand all lines: src/node_http2.cc
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle,
10721072
// Do not report if the frame was not sent due to the session closing
10731073
if (error_code == NGHTTP2_ERR_SESSION_CLOSING ||
10741074
error_code == NGHTTP2_ERR_STREAM_CLOSED ||
1075-
error_code == NGHTTP2_ERR_STREAM_CLOSING ||
1076-
session->js_fields_->frame_error_listener_count == 0) {
1075+
error_code == NGHTTP2_ERR_STREAM_CLOSING) {
10771076
// Nghttp2 contains header limit of 65536. When this value is exceeded the
10781077
// pipeline is stopped and we should remove the current headers reference
10791078
// to destroy the session completely.
Collapse file
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
6+
const http2 = require('http2');
7+
const assert = require('assert');
8+
const {
9+
DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE,
10+
NGHTTP2_CANCEL,
11+
} = http2.constants;
12+
13+
const headerSize = DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE;
14+
const timeout = common.platformTimeout(2_000);
15+
const timer = setTimeout(() => assert.fail(`http2 client timedout
16+
when server can not manage to send a header of size ${headerSize}`), timeout);
17+
18+
const server = http2.createServer((req, res) => {
19+
res.setHeader('foobar', 'a'.repeat(DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE));
20+
res.end();
21+
});
22+
23+
server.listen(0, common.mustCall(() => {
24+
const clientSession = http2.connect(`http://localhost:${server.address().port}`);
25+
clientSession.on('close', common.mustCall());
26+
clientSession.on('remoteSettings', send);
27+
28+
function send() {
29+
const stream = clientSession.request({ ':path': '/' });
30+
stream.on('close', common.mustCall(() => {
31+
assert.strictEqual(stream.rstCode, NGHTTP2_CANCEL);
32+
clearTimeout(timer);
33+
server.close();
34+
}));
35+
36+
stream.end();
37+
}
38+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.