Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ function debugSessionObj(session, message, ...args) {

const kMaxFrameSize = (2 ** 24) - 1;
const kMaxInt = (2 ** 32) - 1;
const kMaxInitialWindowSize = (2 ** 31) - 1; // HTTP/2 spec maximum
const kMaxStreams = (2 ** 32) - 1;
const kMaxALTSVC = (2 ** 14) - 2;

Expand Down Expand Up @@ -989,7 +990,7 @@ function pingCallback(cb) {

// Validates the values in a settings object. Specifically:
// 1. headerTableSize must be a number in the range 0 <= n <= kMaxInt
// 2. initialWindowSize must be a number in the range 0 <= n <= kMaxInt
// 2. initialWindowSize must be a number in the range 0 <= n <= 2^31-1
// 3. maxFrameSize must be a number in the range 16384 <= n <= kMaxFrameSize
// 4. maxConcurrentStreams must be a number in the range 0 <= n <= kMaxStreams
// 5. maxHeaderListSize must be a number in the range 0 <= n <= kMaxInt
Expand All @@ -1014,7 +1015,7 @@ const validateSettings = hideStackFrames((settings) => {
0, kMaxInt);
assertWithinRange.withoutStackTrace('initialWindowSize',
settings.initialWindowSize,
0, kMaxInt);
0, kMaxInitialWindowSize);
assertWithinRange.withoutStackTrace('maxFrameSize',
settings.maxFrameSize,
16384, kMaxFrameSize);
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-http2-getpackedsettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assert.deepStrictEqual(val, check);
['headerTableSize', 0],
['headerTableSize', 2 ** 32 - 1],
['initialWindowSize', 0],
['initialWindowSize', 2 ** 32 - 1],
['initialWindowSize', 2 ** 31 - 1], // Max per HTTP/2 spec
['maxFrameSize', 16384],
['maxFrameSize', 2 ** 24 - 1],
['maxConcurrentStreams', 0],
Expand All @@ -42,6 +42,8 @@ http2.getPackedSettings({ enablePush: false });
['headerTableSize', -1],
['headerTableSize', 2 ** 32],
['initialWindowSize', -1],
['initialWindowSize', 2 ** 31], // Max per HTTP/2 spec is 2^31-1
['initialWindowSize', 2 ** 32 - 1], // Regression test for nghttp2 crash
['initialWindowSize', 2 ** 32],
['maxFrameSize', 16383],
['maxFrameSize', 2 ** 24],
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-http2-session-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ server.listen(
['headerTableSize', -1],
['headerTableSize', 2 ** 32],
['initialWindowSize', -1],
['initialWindowSize', 2 ** 31], // Max per HTTP/2 spec is 2^31-1
['initialWindowSize', 2 ** 32 - 1], // Regression test for nghttp2 crash
['initialWindowSize', 2 ** 32],
['maxFrameSize', 16383],
['maxFrameSize', 2 ** 24],
Expand Down
Loading