Skip to content

Commit

Permalink
Modified the ad-hoc proxy lookup to use _getKey(), rather than the
Browse files Browse the repository at this point in the history
error-prone in-line method.

_getKey() will look for options.target as well as
options.host:options.port, and so is useful for a segmented
proxy server where the destination proxies are not constructed before
first references.
  • Loading branch information
elfsternberg committed Nov 29, 2011
1 parent 1e33434 commit 553e7fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/node-http-proxy/routing-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
options.host = location.host;
}

var key = options.host + ':' + options.port,
proxy;
var key = this._getKey(options),
proxy;

if (!this.proxies[key]) {
this.add(options);
Expand Down Expand Up @@ -218,8 +218,8 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
options.host = location.host;
}

var key = options.host + ':' + options.port,
proxy;
var key = this._getKey(options),
proxy;

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

0 comments on commit 553e7fb

Please sign in to comment.