Skip to content

Commit c98ccb4

Browse files
committed
Fixes memory leak when clients abort connections
1 parent c5dc929 commit c98ccb4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/node-http-proxy/http-proxy.js

+7
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
326326
}
327327
});
328328

329+
//Aborts reverseProxy if client aborts the connection.
330+
req.on('close', function () {
331+
if (!errState) {
332+
reverseProxy.abort();
333+
}
334+
});
335+
329336
//
330337
// If we have been passed buffered data, resume it.
331338
//

0 commit comments

Comments
 (0)