Skip to content

Commit

Permalink
added what is necessary for having proxyError on Routing proxywq
Browse files Browse the repository at this point in the history
  • Loading branch information
temsa authored and indexzero committed Oct 3, 2011
1 parent ccccc45 commit b7adf86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/node-http-proxy/routing-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ RoutingProxy.prototype.add = function (options) {
});

this.proxies[key] = new HttpProxy(options);
this.proxies[key].on('proxyError', this.emit.bind(this, 'proxyError'));
this.proxies[key].on('webSocketProxyError', this.emit.bind(this, 'webSocketProxyError'));
};

//
Expand Down Expand Up @@ -183,6 +185,7 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {

if (!this.proxies[key]) {
this.add(options);

}

proxy = this.proxies[key];
Expand Down Expand Up @@ -220,7 +223,7 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti

if (!this.proxies[key]) {
this.add(options);
}
}

proxy = this.proxies[key];
proxy.proxyWebSocketRequest(req, socket, head, options.buffer);
Expand All @@ -244,4 +247,4 @@ RoutingProxy.prototype._getKey = function (options) {
options.host || options.target.host,
options.port || options.target.port
].join(':');
}
}

0 comments on commit b7adf86

Please sign in to comment.