diff --git a/src/lib/connectors/http.js b/src/lib/connectors/http.js index 7574441ee..e5f8990d5 100644 --- a/src/lib/connectors/http.js +++ b/src/lib/connectors/http.js @@ -39,7 +39,9 @@ function HttpConnector(host, config) { maxKeepAliveTime: 3e5 // 5 minutes }); - this.agent = new KeepAliveAgent({ + var KeepAliveAgent_ = this.host.protocol === 'https' ? KeepAliveAgent.HttpsAgent : KeepAliveAgent; + + this.agent = new KeepAliveAgent_({ maxSockets: config.maxSockets, maxKeepAliveRequests: config.maxKeepAliveRequests, maxKeepAliveTime: config.maxKeepAliveTime