Skip to content

Commit

Permalink
http,https: increase server headers timeout
Browse files Browse the repository at this point in the history
Fixes: #24980
Refs: eb43bc04b1

PR-URL: #30071
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
timcosta authored and targos committed Apr 28, 2020
1 parent 98297b9 commit d609881
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/api/http.md
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/https.md
Expand Up @@ -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`][].

Expand Down
2 changes: 1 addition & 1 deletion lib/_http_server.js
Expand Up @@ -356,7 +356,7 @@ function Server(options, requestListener) {
this.timeout = kDefaultHttpServerTimeout;
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);
Expand Down
2 changes: 1 addition & 1 deletion lib/https.js
Expand Up @@ -81,7 +81,7 @@ function Server(opts, requestListener) {
this.timeout = kDefaultHttpServerTimeout;
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);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-http-slow-headers.js
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-https-slow-headers.js
Expand Up @@ -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
Expand Down

0 comments on commit d609881

Please sign in to comment.