From 5c3d52371202e2f8913b472a3bf1f4276b903938 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Tue, 14 May 2024 14:31:13 +1000 Subject: [PATCH] Use "close" event on res rather than attaching an event handler to the socket --- lib/controllers/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/controllers/proxy.js b/lib/controllers/proxy.js index 595aa5c..11cb609 100644 --- a/lib/controllers/proxy.js +++ b/lib/controllers/proxy.js @@ -198,7 +198,7 @@ module.exports = function(options) { // encoding : null means "body" passed to the callback will be raw bytes var proxiedRequest; - req.socket.once('close', function() { + res.once('close', function() { if (proxiedRequest && !res.writableEnded) { proxiedRequest.abort(); }