From 883ed4b7f1903b188572093ce56efe528e603991 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 bc3bebd11b9c71..c109d7db72ac7a 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1879,6 +1879,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])`