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
Prev Previous commit
Next Next commit
http2: added doc for maxHeaderSize
Refs: #33636
  • Loading branch information
preyunk committed May 31, 2020
commit 8f6c4aaf909486329a1763b907b902fd7b2ce77b
1 change: 1 addition & 0 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,7 @@ properties.
* `maxHeaderListSize` {number} Specifies the maximum size (uncompressed octets)
of header list that will be accepted. The minimum allowed value is 0. The
maximum allowed value is 2<sup>32</sup>-1. **Default:** `65535`.
* `maxHeaderSize` {number} Alias for `maxHeaderListSize`.
* `enableConnectProtocol`{boolean} Specifies `true` if the "Extended Connect
Protocol" defined by [RFC 8441][] is to be enabled. This setting is only
meaningful if sent by the server. Once the `enableConnectProtocol` setting
Expand Down
41 changes: 20 additions & 21 deletions test/parallel/test-http2-too-large-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@ const {
NGHTTP2_ENHANCE_YOUR_CALM
} = http2.constants;

let server = http2.createServer({ settings: { maxHeaderListSize: 100 } });
server.on('stream', common.mustNotCall());
for (const prototype of ['maxHeaderListSize', 'maxHeaderSize']) {
const server = http2.createServer({ settings: { [prototype]: 100 } });
server.on('stream', common.mustNotCall());

Comment thread
himself65 marked this conversation as resolved.
Outdated
server = http2.createServer({ settings: { maxHeaderSize: 100 } });
server.on('stream', common.mustNotCall());
server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);

server.listen(0, common.mustCall(() => {
const client = http2.connect(`http://localhost:${server.address().port}`);
client.on('remoteSettings', () => {
const req = client.request({ 'foo': 'a'.repeat(1000) });
req.on('error', common.expectsError({
code: 'ERR_HTTP2_STREAM_ERROR',
name: 'Error',
message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM'
}));
req.on('close', common.mustCall(() => {
assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM);
server.close();
client.close();
}));
});

client.on('remoteSettings', () => {
const req = client.request({ 'foo': 'a'.repeat(1000) });
req.on('error', common.expectsError({
code: 'ERR_HTTP2_STREAM_ERROR',
name: 'Error',
message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM'
}));
req.on('close', common.mustCall(() => {
assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM);
server.close();
client.close();
}));
});

}));
}));
}