diff --git a/doc/api/http.md b/doc/api/http.md index e0b2c55a56a3d0..b6f770285e6058 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -142,7 +142,7 @@ changes: header is always sent when using an agent except when the `Connection` header is explicitly specified or when the `keepAlive` and `maxSockets` options are respectively set to `false` and `Infinity`, in which case - `Connection: close` will be used. **Default:** `false`. + `Connection: close` will be used. **Default:** `true`. * `keepAliveMsecs` {number} When using the `keepAlive` option, specifies the [initial delay][] for TCP Keep-Alive packets. Ignored when the diff --git a/lib/_http_agent.js b/lib/_http_agent.js index a4829526f6e138..5327b2aec48f2d 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -108,7 +108,7 @@ function Agent(options) { this.sockets = { __proto__: null }; this.freeSockets = { __proto__: null }; this.keepAliveMsecs = this.options.keepAliveMsecs || 1000; - this.keepAlive = this.options.keepAlive || false; + this.keepAlive = this.options.keepAlive || true; this.maxSockets = this.options.maxSockets || Agent.defaultMaxSockets; this.maxFreeSockets = this.options.maxFreeSockets || 256; this.scheduling = this.options.scheduling || 'lifo';