diff options
author | Matteo Collina <hello@matteocollina.com> | 2020-05-14 20:21:34 +0200 |
---|---|---|
committer | Richard Lau <riclau@uk.ibm.com> | 2020-09-15 15:39:54 -0400 |
commit | df08d527c2083b852d8456b88b39114f30525236 (patch) | |
tree | 3957f9865debe958271ab09a941303dc90225f70 /lib/https.js | |
parent | cb90248c145763502ee8fae67960d45293c9e0bf (diff) | |
download | node-new-df08d527c2083b852d8456b88b39114f30525236.tar.gz |
http: add requestTimeout
This commits introduces a new http.Server option called requestTimeout
with a default value in milliseconds of 0.
If requestTimeout is set to a positive value, the server will start a new
timer set to expire in requestTimeout milliseconds when a new connection
is established. The timer is also set again if new requests after the
first are received on the socket (this handles pipelining and keep-alive
cases).
The timer is cancelled when:
1. the request body is completely received by the server.
2. the response is completed. This handles the case where the
application responds to the client without consuming the request body.
3. the connection is upgraded, like in the WebSocket case.
If the timer expires, then the server responds with status code 408 and
closes the connection.
CVE-2020-8251
PR-URL: https://github.com/nodejs-private/node-private/pull/208
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Co-Authored-By: Paolo Insogna <paolo@cowtech.it>
Co-Authored-By: Robert Nagy <ronagy@icloud.com>
Diffstat (limited to 'lib/https.js')
-rw-r--r-- | lib/https.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/https.js b/lib/https.js index 17a89c2f0b..4b21977fe4 100644 --- a/lib/https.js +++ b/lib/https.js @@ -80,6 +80,7 @@ function Server(opts, requestListener) { this.keepAliveTimeout = 5000; this.maxHeadersCount = null; this.headersTimeout = 60 * 1000; // 60 seconds + this.requestTimeout = 120 * 1000; // 120 seconds } ObjectSetPrototypeOf(Server.prototype, tls.Server.prototype); ObjectSetPrototypeOf(Server, tls.Server); |