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
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_http2.cc +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1072,8 +1072,7 @@ int Http2Session::OnFrameNotSent(nghttp2_session* handle, |
1072 | 1072 | // Do not report if the frame was not sent due to the session closing |
1073 | 1073 | if (error_code == NGHTTP2_ERR_SESSION_CLOSING || |
1074 | 1074 | 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) { |
1077 | 1076 | // Nghttp2 contains header limit of 65536. When this value is exceeded the |
1078 | 1077 | // pipeline is stopped and we should remove the current headers reference |
1079 | 1078 | // to destroy the session completely. |
|
Collapse file
Copy file name to clipboard +38Lines changed: 38 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 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 | +})); |