Merge pull request #549 from mmoulton/caronte

Only emit response if a valid server is present
This commit is contained in:
yawnt 2014-01-14 01:23:28 -08:00
commit 0ba4fa8e5e

View File

@ -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; }
}