GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src,http2: ensure cleanup if a frame is not sent · nodejs/node@b0809a7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_http2.cc
  • test/parallel
    • test-h2-large-header-cause-client-to-hangup.js
Expand file treeCollapse file tree
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

‎test/parallel/test-h2-large-header-cause-client-to-hangup.js‎

Copy file name to clipboard
+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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.