From 182dcd34555f361c1bb2b8d2777689e64ce32f87 Mon Sep 17 00:00:00 2001 From: Dominic Tarr Date: Thu, 10 Nov 2011 16:44:23 +1100 Subject: [PATCH] always emit end in 0.4 --- lib/node-http-proxy/http-proxy.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index a391102..8887972 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -266,7 +266,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // already been called and the 'error' event listener // removed. // + var ended = false + response.on('close', function () { + if(!ended) response.emit('end') + }) response.on('end', function () { + ended = true if (!errState) { reverseProxy.removeListener('error', proxyError);