Skip to content

Commit 8eaff1e

Browse files
committed
http: fix http agent keep alive
1 parent 917fcb2 commit 8eaff1e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/_http_agent.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,11 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
342342
installListeners(this, s, options);
343343
cb(null, s);
344344
});
345-
345+
// When keepAlive is true, pass the related options to createConnection
346+
if (this.keepAlive) {
347+
options.keepAlive = this.keepAlive;
348+
options.keepAliveInitialDelay = this.keepAliveMsecs;
349+
}
346350
const newSocket = this.createConnection(options, oncreate);
347351
if (newSocket)
348352
oncreate(null, newSocket);

0 commit comments

Comments
 (0)