From 5b35ffee3c6b360f95a065abfd21c4de8cf77e43 Mon Sep 17 00:00:00 2001 From: Artur K Date: Tue, 14 Sep 2021 14:14:07 +0300 Subject: [PATCH] http: remove "max" hint --- lib/_http_outgoing.js | 21 +++---------------- lib/_http_server.js | 1 - .../test-http-keep-alive-max-requests.js | 4 ++-- ...t-http-keep-alive-pipeline-max-requests.js | 6 +++--- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 557fa90b6107f5..bc86350bfc16b0 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -135,7 +135,6 @@ function OutgoingMessage() { this._header = null; this[kOutHeaders] = null; - this._maxRequestsPerSocket = null; this._keepAliveTimeout = 0; this._onPendingData = nop; @@ -453,23 +452,9 @@ function _storeHeader(firstLine, headers) { header += 'Connection: close' + CRLF; } else if (shouldSendKeepAlive) { header += 'Connection: keep-alive' + CRLF; - - if (this._defaultKeepAlive) { - let keepAliveParameters = ''; - - if (this._keepAliveTimeout) { - const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000); - keepAliveParameters += `timeout=${timeoutSeconds}`; - } - - if (this._maxRequestsPerSocket) { - if (keepAliveParameters.length > 0) keepAliveParameters += ', '; - keepAliveParameters += `max=${this._maxRequestsPerSocket}`; - } - - if (keepAliveParameters.length > 0) { - header += `Keep-Alive: ${keepAliveParameters}${CRLF}`; - } + if (this._keepAliveTimeout && this._defaultKeepAlive) { + const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000); + header += `Keep-Alive: timeout=${timeoutSeconds}${CRLF}`; } } else { this._last = true; diff --git a/lib/_http_server.js b/lib/_http_server.js index bdb608e45d72ee..1d6f3289e789b7 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -878,7 +878,6 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { const res = new server[kServerResponse](req); res._keepAliveTimeout = server.keepAliveTimeout; - res._maxRequestsPerSocket = server.maxRequestsPerSocket; res._onPendingData = updateOutgoingData.bind(undefined, socket, state); diff --git a/test/parallel/test-http-keep-alive-max-requests.js b/test/parallel/test-http-keep-alive-max-requests.js index d1fbc6a7fd0842..657b59ae6d9369 100644 --- a/test/parallel/test-http-keep-alive-max-requests.js +++ b/test/parallel/test-http-keep-alive-max-requests.js @@ -10,11 +10,11 @@ const bodySent = 'This is my request'; function assertResponse(headers, body, expectClosed) { if (expectClosed) { assert.match(headers, /Connection: close\r\n/m); - assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); + assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1); assert.match(body, /Hello World!/m); } else { assert.match(headers, /Connection: keep-alive\r\n/m); - assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m); + assert.match(headers, /Keep-Alive: timeout=5\r\n/m); assert.match(body, /Hello World!/m); } } diff --git a/test/parallel/test-http-keep-alive-pipeline-max-requests.js b/test/parallel/test-http-keep-alive-pipeline-max-requests.js index 0de00b7a04910b..9c5d46a57ce197 100644 --- a/test/parallel/test-http-keep-alive-pipeline-max-requests.js +++ b/test/parallel/test-http-keep-alive-pipeline-max-requests.js @@ -10,11 +10,11 @@ const bodySent = 'This is my request'; function assertResponse(headers, body, expectClosed) { if (expectClosed) { assert.match(headers, /Connection: close\r\n/m); - assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); + assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1); assert.match(body, /Hello World!/m); } else { assert.match(headers, /Connection: keep-alive\r\n/m); - assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m); + assert.match(headers, /Keep-Alive: timeout=5\r\n/m); assert.match(body, /Hello World!/m); } } @@ -75,7 +75,7 @@ server.listen(0, common.mustCall((res) => { assert.match(responseParts[6], /HTTP\/1\.1 503 Service Unavailable/m); assert.match(responseParts[6], /Connection: close\r\n/m); - assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); + assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5\r\n/m), -1); assert.strictEqual(responseParts[7].search(/Hello World!/m), -1); socket.end();