Skip to content
Permalink
Browse files

[fix] merge #495, thanks @glasser

  • Loading branch information...
yawnt committed Nov 7, 2013
1 parent cde08fb commit d0862aff0c693366dcb11649b6abe1d011268953
Showing with 13 additions and 9 deletions.
  1. +1 −1 lib/http-proxy.js
  2. +12 −8 lib/http-proxy/passes/ws-incoming.js
@@ -36,7 +36,7 @@ proxy.createProxyServer = proxy.createServer = function createProxyServer(option
* `options.target and `options.forward` cannot be
* both missing
* }
*/
*/

return new httpProxy.Server(options);
};
@@ -106,15 +106,11 @@ var passes = exports;
common.setupOutgoing(options.ssl || {}, options, req)
);
// Error Handler
proxyReq.on('error', function(err){
if (clb) {
clb(err);
} else {
server.emit('error', err, req, res);
}
});
proxyReq.on('error', onError);

proxyReq.on('upgrade', function(proxyRes, proxySocket, proxyHead) {
proxySocket.on('error', onError);

common.setupSocket(proxySocket);

if (proxyHead && proxyHead.length) proxySocket.unshift(proxyHead);
@@ -126,7 +122,15 @@ var passes = exports;
proxySocket.pipe(socket).pipe(proxySocket);
});

proxyReq.end(); // XXX: CHECK IF THIS IS THIS CORRECT
return proxyReq.end(); // XXX: CHECK IF THIS IS THIS CORRECT

function onError(err) {
if (clb) {
clb(err);
} else {
server.emit('error', err, req, res);
}
}
}

] // <--

0 comments on commit d0862af

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