Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit da6e8cb

Browse filesBrowse files
ronagrichardlau
authored andcommitted
http: unbreak keepAliveTimeoutBuffer
Adds a guard. PR-URL: #59784 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 34b25fd commit da6e8cb
Copy full SHA for da6e8cb

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Open diff view settings
Collapse file

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,16 @@ function resOnFinish(req, res, socket, state, server) {
10251025
socket.end();
10261026
}
10271027
} else if (state.outgoing.length === 0) {
1028-
if (server.keepAliveTimeout && typeof socket.setTimeout === 'function') {
1028+
const keepAliveTimeout = NumberIsFinite(server.keepAliveTimeout) && server.keepAliveTimeout >= 0 ?
1029+
server.keepAliveTimeout : 0;
1030+
const keepAliveTimeoutBuffer = NumberIsFinite(server.keepAliveTimeoutBuffer) && server.keepAliveTimeoutBuffer >= 0 ?
1031+
server.keepAliveTimeoutBuffer : 1e3;
1032+
1033+
if (keepAliveTimeout && typeof socket.setTimeout === 'function') {
10291034
// Extend the internal timeout by the configured buffer to reduce
10301035
// the likelihood of ECONNRESET errors.
10311036
// This allows fine-tuning beyond the advertised keepAliveTimeout.
1032-
socket.setTimeout(server.keepAliveTimeout + server.keepAliveTimeoutBuffer);
1037+
socket.setTimeout(keepAliveTimeout + keepAliveTimeoutBuffer);
10331038
state.keepAliveTimeoutSet = true;
10341039
}
10351040
} else {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.