From e17403ede37d5879c2fa8e9d2c71f1eacbea9366 Mon Sep 17 00:00:00 2001 From: Tim Costa Date: Tue, 22 Oct 2019 18:17:03 -0400 Subject: [PATCH] http,https: increase server headers timeout Fixes: https://github.com/nodejs/node/issues/24980 Refs: https://github.com/nodejs/node/commit/eb43bc04b1 PR-URL: https://github.com/nodejs/node/pull/30071 Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina Reviewed-By: Trivikram Kamat Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott --- doc/api/http.md | 2 +- doc/api/https.md | 2 +- lib/_http_server.js | 2 +- lib/https.js | 2 +- test/parallel/test-http-slow-headers.js | 4 ++-- test/parallel/test-https-slow-headers.js | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index f0d02117e6b33d..6427d56beee42a 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1107,7 +1107,7 @@ Stops the server from accepting new connections. See [`net.Server.close()`][]. added: v11.3.0 --> -* {number} **Default:** `40000` +* {number} **Default:** `60000` Limit the amount of time the parser will wait to receive the complete HTTP headers. diff --git a/doc/api/https.md b/doc/api/https.md index 01e07a24d8a3a9..252d4bb33953a5 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -94,7 +94,7 @@ See [`server.close()`][`http.close()`] from the HTTP module for details. added: v11.3.0 --> -* {number} **Default:** `40000` +* {number} **Default:** `60000` See [`http.Server#headersTimeout`][]. diff --git a/lib/_http_server.js b/lib/_http_server.js index 453cf9005363dc..7afd2c0cd3c763 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -348,7 +348,7 @@ function Server(options, requestListener) { this.timeout = 0; this.keepAliveTimeout = 5000; this.maxHeadersCount = null; - this.headersTimeout = 40 * 1000; // 40 seconds + this.headersTimeout = 60 * 1000; // 60 seconds } ObjectSetPrototypeOf(Server.prototype, net.Server.prototype); ObjectSetPrototypeOf(Server, net.Server); diff --git a/lib/https.js b/lib/https.js index d8383a03052b1b..d1c2a88411e3c8 100644 --- a/lib/https.js +++ b/lib/https.js @@ -77,7 +77,7 @@ function Server(opts, requestListener) { this.timeout = 0; this.keepAliveTimeout = 5000; this.maxHeadersCount = null; - this.headersTimeout = 40 * 1000; // 40 seconds + this.headersTimeout = 60 * 1000; // 60 seconds } ObjectSetPrototypeOf(Server.prototype, tls.Server.prototype); ObjectSetPrototypeOf(Server, tls.Server); diff --git a/test/parallel/test-http-slow-headers.js b/test/parallel/test-http-slow-headers.js index 6da11465dac17b..25ee5b63e8c0e2 100644 --- a/test/parallel/test-http-slow-headers.js +++ b/test/parallel/test-http-slow-headers.js @@ -17,8 +17,8 @@ const headers = const server = createServer(common.mustNotCall()); let sendCharEvery = 1000; -// 40 seconds is the default -assert.strictEqual(server.headersTimeout, 40 * 1000); +// 60 seconds is the default +assert.strictEqual(server.headersTimeout, 60 * 1000); // Pass a REAL env variable to shortening up the default // value which is 40s otherwise this is useful for manual diff --git a/test/parallel/test-https-slow-headers.js b/test/parallel/test-https-slow-headers.js index 531d9ad318fa03..95f0caa9878c5e 100644 --- a/test/parallel/test-https-slow-headers.js +++ b/test/parallel/test-https-slow-headers.js @@ -27,8 +27,8 @@ const server = createServer({ let sendCharEvery = 1000; -// 40 seconds is the default -assert.strictEqual(server.headersTimeout, 40 * 1000); +// 60 seconds is the default +assert.strictEqual(server.headersTimeout, 60 * 1000); // Pass a REAL env variable to shortening up the default // value which is 40s otherwise