From b98c00eb0b9402be174aba1ea67e489879fb35cb Mon Sep 17 00:00:00 2001 From: Jason von Nieda Date: Mon, 13 Jan 2014 14:58:52 -0800 Subject: [PATCH 1/2] 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. --- src/lib/connectors/http.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/connectors/http.js b/src/lib/connectors/http.js index 7574441ee..702bf0ab0 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 : KeepAliveAgent.HttpsAgent; + + this.agent = new KeepAliveAgent_({ maxSockets: config.maxSockets, maxKeepAliveRequests: config.maxKeepAliveRequests, maxKeepAliveTime: config.maxKeepAliveTime From e9648638d978cb5c48eadfefca664a51bd576a50 Mon Sep 17 00:00:00 2001 From: Jason von Nieda Date: Mon, 13 Jan 2014 15:04:53 -0800 Subject: [PATCH 2/2] Fixes a transposition of the agent class names. --- src/lib/connectors/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/connectors/http.js b/src/lib/connectors/http.js index 702bf0ab0..e5f8990d5 100644 --- a/src/lib/connectors/http.js +++ b/src/lib/connectors/http.js @@ -39,7 +39,7 @@ function HttpConnector(host, config) { maxKeepAliveTime: 3e5 // 5 minutes }); - var KeepAliveAgent_ = this.host.protocol === 'https' ? KeepAliveAgent : KeepAliveAgent.HttpsAgent; + var KeepAliveAgent_ = this.host.protocol === 'https' ? KeepAliveAgent.HttpsAgent : KeepAliveAgent; this.agent = new KeepAliveAgent_({ maxSockets: config.maxSockets,