mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] Handle errors on request object
Sometimes a request emits `error` event with a `Parse Error`.
This commit is contained in:
parent
6cd78f6af9
commit
edfe869159
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user