From 2e259220cb663ca26788fd7eba37653a452b0b73 Mon Sep 17 00:00:00 2001 From: Vincent Boivin Date: Sun, 27 Sep 2020 20:52:11 -0400 Subject: [PATCH] http2: add updateSettings to both http2 servers Allow the user to update the server settings after using http2.createSecureServer() or after using http2.createServer(). Fixes: https://github.com/nodejs/node/issues/35353 PR-URL: https://github.com/nodejs/node/pull/35383 Reviewed-By: Matteo Collina Reviewed-By: Denys Otrishko Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Anatoli Papirovski Reviewed-By: Yongsheng Zhang Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- doc/api/http2.md | 26 +++++++++ lib/internal/http2/core.js | 12 +++++ test/parallel/test-http2-update-settings.js | 59 +++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 test/parallel/test-http2-update-settings.js diff --git a/doc/api/http2.md b/doc/api/http2.md index f033b50548a..e4239ce6494 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1878,6 +1878,19 @@ A value of `0` will disable the timeout behavior on incoming connections. The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections. +#### `server.updateSettings([settings])` + + +* `settings` {HTTP/2 Settings Object} + +Used to update the server with the provided settings. + +Throws `ERR_HTTP2_INVALID_SETTING_VALUE` for invalid `settings` values. + +Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument. + ### Class: `Http2SecureServer` + +* `settings` {HTTP/2 Settings Object} + +Used to update the server with the provided settings. + +Throws `ERR_HTTP2_INVALID_SETTING_VALUE` for invalid `settings` values. + +Throws `ERR_INVALID_ARG_TYPE` for invalid `settings` argument. + ### `http2.createServer(options[, onRequestHandler])`