From 4d43d81e5c2d7c8088716d4fd574019f43ebb5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Sat, 29 Oct 2011 18:11:05 +0200 Subject: [PATCH] [fix] When client request is aborted, abort server request --- 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 83a2bf1..bb4f453 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -322,6 +322,13 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) { // reverseProxy.once('error', proxyError); + // + // If `req` is aborted, we abort our `reverseProxy` request as well. + // + req.on('aborted', function () { + reverseProxy.abort(); + }); + // // For each data `chunk` received from the incoming // `req` write it to the `reverseProxy` request.