Skip to content

fixed issue #364 'proxyError' event emitted twice #374

Merged
merged 2 commits into from Mar 9, 2013
View
12 lib/node-http-proxy/http-proxy.js
@@ -312,9 +312,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
// Handle 'error' events from the `reverseProxy`.
//
reverseProxy.once('error', proxyError);
- reverseProxy.once('socket', function (socket) {
- socket.once('error', proxyError);
- });
//
// Handle 'error' events from the `req` (e.g. `Parse Error`).
@@ -719,20 +716,17 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
return proxyError(ex);
}
- // Catch socket errors
- socket.on('error', proxyError);
-
//
// Remove data listener now that the 'handshake' is complete
//
revSocket.removeListener('data', handshake);
});
});
+ //
+ // Handle 'error' events from the `reverseProxy`.
+ //
reverseProxy.on('error', proxyError);
- reverseProxy.once('socket', function (socket) {
- socket.once('error', proxyError);
- });
//
// Handle 'error' events from the `req` (e.g. `Parse Error`).
Something went wrong with that request. Please try again.