[fix] Handle errors on request object

Sometimes a request emits `error` event with a `Parse Error`.
This commit is contained in:
Maciej Małecki 2012-12-21 20:56:01 +01:00
parent 6cd78f6af9
commit edfe869159

View File

@ -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.
//
@ -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