http: refactor headersTimeout and requestTimeout logic

PR-URL: https://github.com/nodejs/node/pull/41263
Fixes: https://github.com/nodejs/node/issues/33440
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Paolo Insogna
2022-04-13 16:47:59 +02:00
committed by GitHub
parent 9d6af7d1fe
commit 3caa2c1a00
33 changed files with 858 additions and 413 deletions

View File

@@ -40,6 +40,7 @@ const tls = require('tls');
const { Agent: HttpAgent } = require('_http_agent');
const {
Server: HttpServer,
setupConnectionsTracking,
storeHTTPOptions,
_connectionListener,
} = require('_http_server');
@@ -80,10 +81,8 @@ function Server(opts, requestListener) {
});
this.timeout = 0;
this.keepAliveTimeout = 5000;
this.maxHeadersCount = null;
this.headersTimeout = 60 * 1000; // 60 seconds
this.requestTimeout = 0;
setupConnectionsTracking(this);
}
ObjectSetPrototypeOf(Server.prototype, tls.Server.prototype);
ObjectSetPrototypeOf(Server, tls.Server);