diff --git a/lib/caronte.js b/lib/caronte.js index ed0280cfa..337fac94d 100644 --- a/lib/caronte.js +++ b/lib/caronte.js @@ -28,12 +28,10 @@ proxy.createProxyServer = function createProxyServer(options) { " { ", " target : ", " forward: ", - " agent : ", + " agent : ", " ssl : ", " ws : ", " xfwd : ", - " maxSock: ", - " agent : ", " } ", " ", "NOTE: `options.ws` and `options.ssl` are optional. ", diff --git a/lib/caronte/common.js b/lib/caronte/common.js index 47ada1b6a..e84f36ca5 100644 --- a/lib/caronte/common.js +++ b/lib/caronte/common.js @@ -1,8 +1,5 @@ -var common = exports - , http = require('http') - , https = require('https') - , extend = require('util')._extend - ; +var common = exports, + extend = require('util')._extend; /** * Copies the right headers from `options` and `req` to @@ -28,7 +25,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) { outgoing.port = options[forward || 'target'].port || (~['https:', 'wss:'].indexOf(options[forward || 'target'].protocol) ? 443 : 80); - ['host', 'hostname', 'socketPath', 'agent'].forEach( + ['host', 'hostname', 'socketPath'].forEach( function(e) { outgoing[e] = options[forward || 'target'][e]; } ); @@ -39,16 +36,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) { if (options.headers){ extend(outgoing.headers, options.headers); } - - if (options.agent){ - outgoing.agent = options.agent; - } - - if (!outgoing.agent){ - var Agent = (~['https:', 'wss:'].indexOf(options[forward || 'target'].protocol) ? https.Agent : http.Agent); - outgoing.agent = new Agent(options.maxSock || 100); - } - + + outgoing.agent = options.agent || false; outgoing.path = req.url; return outgoing;