From 25ec27e3395a1ff2d42a72f0e84e9c5511311c9d Mon Sep 17 00:00:00 2001 From: avimar Date: Wed, 18 Oct 2023 22:18:19 +0300 Subject: [PATCH] backport "fix: use more reliable close event" Backport e183e5d87435f73baa83024e937a0bcddf807757 to enable v6 branch of restify to work with nodejs v16 and up. --- lib/plugins/bodyReader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/bodyReader.js b/lib/plugins/bodyReader.js index 3736aadec..a1b2c5552 100644 --- a/lib/plugins/bodyReader.js +++ b/lib/plugins/bodyReader.js @@ -178,7 +178,7 @@ function bodyReader(options) { // add 'close and 'aborted' event handlers so that requests (and their // corresponding memory) don't leak if client stops sending data half // way through a POST request - req.once('close', next); + req.socket.once('close', next); req.once('aborted', next); req.resume(); }