Fixes a bug that causes HTTPS to never be used. Without using the HttpAgent version of KeepAliveAgent the connections always default to http instead of https, even when https is specified as the protocol.

This commit is contained in:
Jason von Nieda
2014-01-13 14:58:52 -08:00
parent 58cc6336e3
commit b98c00eb0b

View File

@ -39,7 +39,9 @@ function HttpConnector(host, config) {
maxKeepAliveTime: 3e5 // 5 minutes
});
this.agent = new KeepAliveAgent({
var KeepAliveAgent_ = this.host.protocol === 'https' ? KeepAliveAgent : KeepAliveAgent.HttpsAgent;
this.agent = new KeepAliveAgent_({
maxSockets: config.maxSockets,
maxKeepAliveRequests: config.maxKeepAliveRequests,
maxKeepAliveTime: config.maxKeepAliveTime