Skip to content

Commit 8b38c99

Browse files
committed
Merge pull request #374 from erasmospunk/master
fixed issue #364 'proxyError' event emitted twice
2 parents c686ac7 + 3b84e27 commit 8b38c99

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/node-http-proxy/http-proxy.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
312312
// Handle 'error' events from the `reverseProxy`.
313313
//
314314
reverseProxy.once('error', proxyError);
315-
reverseProxy.once('socket', function (socket) {
316-
socket.once('error', proxyError);
317-
});
318315

319316
//
320317
// Handle 'error' events from the `req` (e.g. `Parse Error`).
@@ -719,20 +716,17 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
719716
return proxyError(ex);
720717
}
721718

722-
// Catch socket errors
723-
socket.on('error', proxyError);
724-
725719
//
726720
// Remove data listener now that the 'handshake' is complete
727721
//
728722
revSocket.removeListener('data', handshake);
729723
});
730724
});
731725

726+
//
727+
// Handle 'error' events from the `reverseProxy`.
728+
//
732729
reverseProxy.on('error', proxyError);
733-
reverseProxy.once('socket', function (socket) {
734-
socket.once('error', proxyError);
735-
});
736730

737731
//
738732
// Handle 'error' events from the `req` (e.g. `Parse Error`).

0 commit comments

Comments
 (0)