From c98ccb40e9fe5c5198a1605fa8835efc3ff1856c Mon Sep 17 00:00:00 2001 From: Camilo Aguilar Date: Tue, 15 Nov 2011 20:20:47 -0500 Subject: [PATCH] Fixes memory leak when clients abort connections --- lib/node-http-proxy/http-proxy.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 82bc533..35ddb3d 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -326,6 +326,13 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { } }); + //Aborts reverseProxy if client aborts the connection. + req.on('close', function () { + if (!errState) { + reverseProxy.abort(); + } + }); + // // If we have been passed buffered data, resume it. //