Skip to content

Commit

Permalink
Only create an agent when a relevant option is passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Feb 5, 2011
1 parent 146b154 commit 8756120
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ Request.prototype.request = function () {
{"http:":http, "https:":https}[options.proxy ? options.proxy.protocol : options.uri.protocol]
if (!options.httpModule) throw new Error("Invalid protocol");

options.agent = options.getAgent(options.host, options.port);
if (options.maxSockets) {
options.agent = options.getAgent(options.host, options.port);
options.agent.maxSockets = options.maxSockets;
}
if (options.pool.maxSockets) {
options.agent = options.getAgent(options.host, options.port);
options.agent.maxSockets = options.pool.maxSockets;
}

Expand Down

0 comments on commit 8756120

Please sign in to comment.