Skip to content

Commit

Permalink
[fix] Handle errors on request object
Browse files Browse the repository at this point in the history
Sometimes a request emits `error` event with a `Parse Error`.
  • Loading branch information
mmalecki committed Dec 21, 2012
1 parent 6cd78f6 commit edfe869
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/node-http-proxy/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
socket.once('error', proxyError);
});

//
// Handle 'error' events from the `req` (e.g. `Parse Error`).
//
req.on('error', proxyError);

//
// If `req` is aborted, we abort our `reverseProxy` request as well.
//
Expand Down Expand Up @@ -731,6 +736,11 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, head, buffer)
socket.once('error', proxyError);
});

//
// Handle 'error' events from the `req` (e.g. `Parse Error`).
//
req.on('error', proxyError);

try {
//
// Attempt to write the upgrade-head to the reverseProxy
Expand Down

0 comments on commit edfe869

Please sign in to comment.