mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] closes #553
This commit is contained in:
parent
3330e125aa
commit
53a2653b5e
@ -26,9 +26,15 @@ httpProxy.Server = ProxyServer;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function createRightProxy(type) {
|
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(options) {
|
||||||
return function(req, res /*, [head], [opts] */) {
|
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),
|
args = [].slice.call(arguments),
|
||||||
cntr = args.length - 1,
|
cntr = args.length - 1,
|
||||||
head, cbl;
|
head, cbl;
|
||||||
@ -62,7 +68,8 @@ function createRightProxy(type) {
|
|||||||
if (typeof options[e] === 'string')
|
if (typeof options[e] === 'string')
|
||||||
options[e] = parse_url(options[e]);
|
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++) {
|
for(var i=0; i < passes.length; i++) {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user