Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fix] Handle socket errors
  • Loading branch information
mmalecki committed Dec 12, 2012
1 parent 7bc1a62 commit 2a61ec8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/node-http-proxy/http-proxy.js
Expand Up @@ -314,6 +314,9 @@ 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);
});

//
// If `req` is aborted, we abort our `reverseProxy` request as well.
Expand Down Expand Up @@ -724,6 +727,9 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
});

reverseProxy.on('error', proxyError);
reverseProxy.once('socket', function (socket) {
socket.once('error', proxyError);
});

try {
//
Expand Down

0 comments on commit 2a61ec8

Please sign in to comment.