From 223eacda85a4267f2860f6c46f7dedfa9db8c224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Sun, 23 Dec 2012 00:44:21 +0100 Subject: [PATCH] [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. --- lib/node-http-proxy/http-proxy.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 1348d35..e23d551 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -271,8 +271,6 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { response.on('end', function () { ended = true; if (!errState) { - reverseProxy.removeListener('error', proxyError); - try { res.end() } catch (ex) { console.error("res.end error: %s", ex.message) }