Skip to content

Commit

Permalink
Merge pull request #374 from erasmospunk/master
Browse files Browse the repository at this point in the history
fixed issue #364 'proxyError' event emitted twice
  • Loading branch information
indexzero committed Mar 9, 2013
2 parents c686ac7 + 3b84e27 commit 8b38c99
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/node-http-proxy/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down Expand Up @@ -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`).
Expand Down

0 comments on commit 8b38c99

Please sign in to comment.