mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] Don't remove error listener after response ends
In some rare cases, `error` event might still be emitted after the response has ended. This is (most likely) a bug in the `node` core.
This commit is contained in:
parent
edfe869159
commit
223eacda85
@ -271,8 +271,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
|||||||
response.on('end', function () {
|
response.on('end', function () {
|
||||||
ended = true;
|
ended = true;
|
||||||
if (!errState) {
|
if (!errState) {
|
||||||
reverseProxy.removeListener('error', proxyError);
|
|
||||||
|
|
||||||
try { res.end() }
|
try { res.end() }
|
||||||
catch (ex) { console.error("res.end error: %s", ex.message) }
|
catch (ex) { console.error("res.end error: %s", ex.message) }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user