From f0bee9b490e55ae93da1d1f8a485a4a432e61575 Mon Sep 17 00:00:00 2001 From: ZYSzys Date: Thu, 3 Oct 2019 23:07:42 +0800 Subject: http2: set default maxConcurrentStreams Set the default maxConcurrentStreams to NGHTTP2_DEFAULT_MAX_CONCURRENT_STREAMS. PR-URL: https://github.com/nodejs/node/pull/29833 Fixes: https://github.com/nodejs/node/issues/29763 Refs: https://github.com/nghttp2/nghttp2/commit/16c46114dc724278beaa6d59462f8396f35fa4a9 Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: Anto Aravinth --- test/parallel/test-http2-binding.js | 2 ++ .../parallel/test-http2-client-setNextStreamID-errors.js | 4 ++-- .../test-http2-client-settings-before-connect.js | 2 +- test/parallel/test-http2-getpackedsettings.js | 16 ++-------------- 4 files changed, 7 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/parallel/test-http2-binding.js b/test/parallel/test-http2-binding.js index 82eafc0de9..f12fd1a8ca 100644 --- a/test/parallel/test-http2-binding.js +++ b/test/parallel/test-http2-binding.js @@ -16,6 +16,7 @@ assert.strictEqual(typeof binding.Http2Session, 'function'); const settings = http2.getDefaultSettings(); assert.strictEqual(settings.headerTableSize, 4096); assert.strictEqual(settings.enablePush, true); +assert.strictEqual(settings.maxConcurrentStreams, 4294967295); assert.strictEqual(settings.initialWindowSize, 65535); assert.strictEqual(settings.maxFrameSize, 16384); @@ -227,6 +228,7 @@ const expectedNGConstants = { const defaultSettings = { DEFAULT_SETTINGS_HEADER_TABLE_SIZE: 4096, DEFAULT_SETTINGS_ENABLE_PUSH: 1, + DEFAULT_SETTINGS_MAX_CONCURRENT_STREAMS: 4294967295, DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: 65535, DEFAULT_SETTINGS_MAX_FRAME_SIZE: 16384 }; diff --git a/test/parallel/test-http2-client-setNextStreamID-errors.js b/test/parallel/test-http2-client-setNextStreamID-errors.js index 39d194e1f5..203b552ef7 100644 --- a/test/parallel/test-http2-client-setNextStreamID-errors.js +++ b/test/parallel/test-http2-client-setNextStreamID-errors.js @@ -26,14 +26,14 @@ server.listen(0, common.mustCall(() => { const client = http2.connect(`http://localhost:${server.address().port}`); client.on('connect', () => { - const outOfRangeNum = 2 ** 31; + const outOfRangeNum = 2 ** 32; common.expectsError( () => client.setNextStreamID(outOfRangeNum), { type: RangeError, code: 'ERR_OUT_OF_RANGE', message: 'The value of "id" is out of range.' + - ' It must be > 0 and <= 2147483647. Received ' + outOfRangeNum + ' It must be > 0 and <= 4294967295. Received ' + outOfRangeNum } ); diff --git a/test/parallel/test-http2-client-settings-before-connect.js b/test/parallel/test-http2-client-settings-before-connect.js index 961292d803..8bcdabe326 100644 --- a/test/parallel/test-http2-client-settings-before-connect.js +++ b/test/parallel/test-http2-client-settings-before-connect.js @@ -28,7 +28,7 @@ server.listen(0, common.mustCall(() => { ['maxFrameSize', 1, RangeError], ['maxFrameSize', 2 ** 24, RangeError], ['maxConcurrentStreams', -1, RangeError], - ['maxConcurrentStreams', 2 ** 31, RangeError], + ['maxConcurrentStreams', 2 ** 32, RangeError], ['maxHeaderListSize', -1, RangeError], ['maxHeaderListSize', 2 ** 32, RangeError], ['enablePush', 'a', TypeError], diff --git a/test/parallel/test-http2-getpackedsettings.js b/test/parallel/test-http2-getpackedsettings.js index 77c8cf442f..341cfb4fc7 100644 --- a/test/parallel/test-http2-getpackedsettings.js +++ b/test/parallel/test-http2-getpackedsettings.js @@ -7,6 +7,7 @@ const assert = require('assert'); const http2 = require('http2'); const check = Buffer.from([0x00, 0x01, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0x00, 0x05, 0x00, 0x00, 0x40, 0x00, 0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x00, 0x06, 0x00, 0x00, 0xff, 0xff, @@ -41,7 +42,7 @@ http2.getPackedSettings({ enablePush: false }); ['maxFrameSize', 16383], ['maxFrameSize', 2 ** 24], ['maxConcurrentStreams', -1], - ['maxConcurrentStreams', 2 ** 31], + ['maxConcurrentStreams', 2 ** 32], ['maxHeaderListSize', -1], ['maxHeaderListSize', 2 ** 32] ].forEach((i) => { @@ -168,16 +169,3 @@ http2.getPackedSettings({ enablePush: false }); message: 'Invalid value for setting "maxFrameSize": 16777216' }); } - -// Check for maxConcurrentStreams failing the max number. -{ - const packed = Buffer.from([0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF]); - - common.expectsError(() => { - http2.getUnpackedSettings(packed, { validate: true }); - }, { - code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - type: RangeError, - message: 'Invalid value for setting "maxConcurrentStreams": 4294967295' - }); -} -- cgit v1.2.3