From 642e15805dbd572835bb4fee9527e4f2da658833 Mon Sep 17 00:00:00 2001 From: timmattison Date: Tue, 26 Apr 2011 12:27:24 -0400 Subject: [PATCH] Fixed "Invalid argument to getAgent" when proxying HTTP --- lib/node-http-proxy.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/node-http-proxy.js b/lib/node-http-proxy.js index 9f3521c0a..10b6cfcbb 100644 --- a/lib/node-http-proxy.js +++ b/lib/node-http-proxy.js @@ -45,11 +45,9 @@ exports.version = [0, 5, 0]; // and sets the `maxSockets` property appropriately. // function _getAgent (host, port, secure) { - var agent = !secure ? http.getAgent(host, port) : https.getAgent({ - host: host, - port: port - }); - + var options = { host: host, port: port }; + var agent = !secure ? http.getAgent(options) : https.getAgent(options); + agent.maxSockets = maxSockets; return agent; } @@ -668,4 +666,4 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, options if (options.buffer && !errState) { options.buffer.resume(); } -}; \ No newline at end of file +};