Skip to content

Commit 5b35ffe

Browse files
committed
http: remove "max" hint
1 parent c2d9664 commit 5b35ffe

File tree

4 files changed

+8
-24
lines changed

4 files changed

+8
-24
lines changed

lib/_http_outgoing.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ function OutgoingMessage() {
135135
this._header = null;
136136
this[kOutHeaders] = null;
137137

138-
this._maxRequestsPerSocket = null;
139138
this._keepAliveTimeout = 0;
140139

141140
this._onPendingData = nop;
@@ -453,23 +452,9 @@ function _storeHeader(firstLine, headers) {
453452
header += 'Connection: close' + CRLF;
454453
} else if (shouldSendKeepAlive) {
455454
header += 'Connection: keep-alive' + CRLF;
456-
457-
if (this._defaultKeepAlive) {
458-
let keepAliveParameters = '';
459-
460-
if (this._keepAliveTimeout) {
461-
const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000);
462-
keepAliveParameters += `timeout=${timeoutSeconds}`;
463-
}
464-
465-
if (this._maxRequestsPerSocket) {
466-
if (keepAliveParameters.length > 0) keepAliveParameters += ', ';
467-
keepAliveParameters += `max=${this._maxRequestsPerSocket}`;
468-
}
469-
470-
if (keepAliveParameters.length > 0) {
471-
header += `Keep-Alive: ${keepAliveParameters}${CRLF}`;
472-
}
455+
if (this._keepAliveTimeout && this._defaultKeepAlive) {
456+
const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000);
457+
header += `Keep-Alive: timeout=${timeoutSeconds}${CRLF}`;
473458
}
474459
} else {
475460
this._last = true;

lib/_http_server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ function parserOnIncoming(server, socket, state, req, keepAlive) {
878878

879879
const res = new server[kServerResponse](req);
880880
res._keepAliveTimeout = server.keepAliveTimeout;
881-
res._maxRequestsPerSocket = server.maxRequestsPerSocket;
882881
res._onPendingData = updateOutgoingData.bind(undefined,
883882
socket, state);
884883

test/parallel/test-http-keep-alive-max-requests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const bodySent = 'This is my request';
1010
function assertResponse(headers, body, expectClosed) {
1111
if (expectClosed) {
1212
assert.match(headers, /Connection: close\r\n/m);
13-
assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1);
13+
assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1);
1414
assert.match(body, /Hello World!/m);
1515
} else {
1616
assert.match(headers, /Connection: keep-alive\r\n/m);
17-
assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m);
17+
assert.match(headers, /Keep-Alive: timeout=5\r\n/m);
1818
assert.match(body, /Hello World!/m);
1919
}
2020
}

test/parallel/test-http-keep-alive-pipeline-max-requests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const bodySent = 'This is my request';
1010
function assertResponse(headers, body, expectClosed) {
1111
if (expectClosed) {
1212
assert.match(headers, /Connection: close\r\n/m);
13-
assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1);
13+
assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1);
1414
assert.match(body, /Hello World!/m);
1515
} else {
1616
assert.match(headers, /Connection: keep-alive\r\n/m);
17-
assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m);
17+
assert.match(headers, /Keep-Alive: timeout=5\r\n/m);
1818
assert.match(body, /Hello World!/m);
1919
}
2020
}
@@ -75,7 +75,7 @@ server.listen(0, common.mustCall((res) => {
7575

7676
assert.match(responseParts[6], /HTTP\/1\.1 503 Service Unavailable/m);
7777
assert.match(responseParts[6], /Connection: close\r\n/m);
78-
assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5, max=3\r\n/m), -1);
78+
assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5\r\n/m), -1);
7979
assert.strictEqual(responseParts[7].search(/Hello World!/m), -1);
8080

8181
socket.end();

0 commit comments

Comments
 (0)