mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] Make options immutable in RoutingProxy. Fixes #248.
This commit is contained in:
parent
b1c4bd61e8
commit
4c1a2c1416
@ -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;
|
||||
};
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user