[fix] closes #553

This commit is contained in:
yawnt 2014-01-17 22:18:20 +01:00
parent 3330e125aa
commit 53a2653b5e

View File

@ -26,9 +26,15 @@ httpProxy.Server = ProxyServer;
*/
function createRightProxy(type) {
var webPasses = Object.keys(web).map(function(pass) {
return web[pass];
});
var wsPasses = Object.keys(ws).map(function(pass) {
return ws[pass];
});
return function(options) {
return function(req, res /*, [head], [opts] */) {
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
var passes = (type === 'ws') ? (this.wsPasses || wsPasses) : (this.webPasses || webPasses),
args = [].slice.call(arguments),
cntr = args.length - 1,
head, cbl;
@ -62,7 +68,8 @@ function createRightProxy(type) {
if (typeof options[e] === 'string')
options[e] = parse_url(options[e]);
});
if(typeof this.emit == 'undefined' && !cbl) { throw new Error("You need to pass a callback to handle errors") }
for(var i=0; i < passes.length; i++) {
/**