From 7c4121c55db17121f014bb99adaa78cf21f0140c Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Wed, 1 May 2024 16:51:14 +0200 Subject: [PATCH] Fixed FastCGI connections not closing properly, when SVR.JS is running on Bun --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index e6f6dc9..fd64cbc 100644 --- a/index.js +++ b/index.js @@ -182,6 +182,11 @@ function createFastCGIHandler(options) { if (typeof socket !== "undefined") { socket.removeListener("data", fastCGISocketHandler); processFastCGIPacket = function() {}; + try { + socket.end(); //Fixes connection not closing properly in Bun + } catch (err) { + //It is already closed + } } var appStatus = processedPacket.content.readUInt32BE(0); var protocolStatus = processedPacket.content.readUInt8(4);