From e7197bd2bbc3a84ccfbf479066fdc80543d20780 Mon Sep 17 00:00:00 2001 From: Jason Walton Date: Mon, 3 Feb 2014 12:01:02 -0500 Subject: [PATCH] Issue #570: Use http.globalAgent as agent if no agent is explicitly specified. --- lib/http-proxy/common.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/http-proxy/common.js b/lib/http-proxy/common.js index 789757880..5ec87ff44 100644 --- a/lib/http-proxy/common.js +++ b/lib/http-proxy/common.js @@ -1,5 +1,6 @@ var common = exports, url = require('url'), + http = require('http'), extend = require('util')._extend; /** @@ -42,8 +43,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) { outgoing.rejectUnauthorized = (typeof options.secure === "undefined") ? true : options.secure; } + outgoing.agent = (options.agent == null) ? http.globalAgent : options.agent - outgoing.agent = options.agent || false; outgoing.path = url.parse(req.url).path; return outgoing; };