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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
timcosta authored and MylesBorins committed Dec 17, 2019
1 parent 2430dd8 commit 1722280
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-http-slow-headers.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 1722280

Please sign in to comment.