[fix] Make options immutable in RoutingProxy. Fixes #248.

This commit is contained in:
indexzero 2013-03-09 02:21:31 -05:00
parent b1c4bd61e8
commit 4c1a2c1416
3 changed files with 7 additions and 6 deletions

View File

@ -101,7 +101,7 @@ var HttpProxy = exports.HttpProxy = function (options) {
// be provided or the operation will fail with an `origin mismatch`
// by definition.
//
this.source = options.source || { host: 'localhost', port: 8000 };
this.source = options.source || { host: 'localhost', port: 80 };
this.source.https = this.source.https || options.https;
this.changeOrigin = options.changeOrigin || false;
};

View File

@ -7,7 +7,7 @@
*/
var events = require('events'),
util = require('util'),
utile = require('utile'),
HttpProxy = require('./http-proxy').HttpProxy,
ProxyTable = require('./proxy-table').ProxyTable;
@ -70,7 +70,7 @@ var RoutingProxy = exports.RoutingProxy = function (options) {
//
// Inherit from `events.EventEmitter`.
//
util.inherits(RoutingProxy, events.EventEmitter);
utile.inherits(RoutingProxy, events.EventEmitter);
//
// ### function add (options)
@ -227,7 +227,7 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
}
if (!this.proxies[key]) {
this.add(options);
this.add(utile.clone(options));
}
proxy = this.proxies[key];
@ -267,7 +267,7 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
key = this._getKey(options);
if (!this.proxies[key]) {
this.add(options);
this.add(utile.clone(options));
}
proxy = this.proxies[key];

View File

@ -19,7 +19,8 @@
"dependencies": {
"colors": "0.x.x",
"optimist": "0.3.x",
"pkginfo": "0.2.x"
"pkginfo": "0.2.x",
"utile": "~0.1.7"
},
"devDependencies": {
"request": "1.9.x",