Fixed "Invalid argument to getAgent" when proxying HTTP

This commit is contained in:
timmattison 2011-04-26 12:27:24 -04:00
parent ddf31b22ec
commit 642e15805d

View File

@ -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();
}
};
};