Skip to content
Permalink
Browse files

Merge pull request #551 from nodejitsu/caronte

Caronte
  • Loading branch information...
yawnt committed Jan 16, 2014
2 parents 0b642d4 + d23353d commit d4942e52e7a3579c8f3b032d697e783c8aea8224
Showing with 13 additions and 2 deletions.
  1. +7 −0 lib/http-proxy.js
  2. +5 −1 lib/http-proxy/index.js
  3. +1 −1 lib/http-proxy/passes/web-incoming.js
@@ -8,6 +8,13 @@ var http = require('http'),
*/
module.exports = httpProxy.Server;

module.exports.createProxy = function(options) {
return {
web: httpProxy.createRightProxy('web')(options),
ws: httpProxy.createRightProxy('ws')(options)
};
}

/**
* Creates the proxy server.
*
@@ -80,7 +80,7 @@ function createRightProxy(type) {
};
};
}

httpProxy.createRightProxy = createRightProxy;

function ProxyServer(options) {
EE3.call(this);
@@ -96,6 +96,10 @@ function ProxyServer(options) {
this.wsPasses = Object.keys(ws).map(function(pass) {
return ws[pass];
});

this.on('error', function(err) {
console.log(err);
});
}

require('util').inherits(ProxyServer, EE3);
@@ -117,7 +117,7 @@ web_o = Object.keys(web_o).map(function(pass) {
(options.buffer || req).pipe(proxyReq);

proxyReq.on('response', function(proxyRes) {
server.emit('proxyRes', proxyRes);
if(server) { server.emit('proxyRes', proxyRes); }
for(var i=0; i < web_o.length; i++) {
if(web_o[i](req, res, proxyRes)) { break; }
}

0 comments on commit d4942e5

Please sign in to comment.
You can’t perform that action at this time.