From 8ac546ff6790166577e9cb30e01d9a0f2e2f7d8c Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sat, 9 Mar 2024 15:45:31 +0100 Subject: [PATCH] Be case insensitive in header name exclusion in shimmed HTTP/1.x res.setHeader method --- svr.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/svr.js b/svr.js index 807616c..4410e82 100644 --- a/svr.js +++ b/svr.js @@ -2922,6 +2922,7 @@ if (!cluster.isPrimary) { // Set HTTP/1.x methods (to prevent process warnings) res.writeHeadNodeApi = res.writeHead; res.setHeaderNodeApi = res.setHeader; + res.writeHead = function (a, b, c) { var table = c; if (typeof (b) == "object") table = b; @@ -2940,9 +2941,9 @@ if (!cluster.isPrimary) { return res.writeHeadNodeApi(a, table); } }; - - res.setHeader = function (a, b) { - if (a != "transfer-encoding" && a != "connection" && a != "keep-alive" && a != "upgrade") return res.setHeaderNodeApi(a, b); + res.setHeader = function (headerName, headerValue) { + var al = headerName.toLowerCase(); + if (al != "transfer-encoding" && al != "connection" && al != "keep-alive" && al != "upgrade") return res.setHeaderNodeApi(headerName, headerValue); return false; };