1
0
Fork 0
forked from svrjs/svrjs

Be case insensitive in header name exclusion in shimmed HTTP/1.x res.setHeader method

This commit is contained in:
Dorian Niemiec 2024-03-09 15:45:31 +01:00
parent 382d496934
commit 8ac546ff67

7
svr.js
View file

@ -2922,6 +2922,7 @@ if (!cluster.isPrimary) {
// Set HTTP/1.x methods (to prevent process warnings) // Set HTTP/1.x methods (to prevent process warnings)
res.writeHeadNodeApi = res.writeHead; res.writeHeadNodeApi = res.writeHead;
res.setHeaderNodeApi = res.setHeader; res.setHeaderNodeApi = res.setHeader;
res.writeHead = function (a, b, c) { res.writeHead = function (a, b, c) {
var table = c; var table = c;
if (typeof (b) == "object") table = b; if (typeof (b) == "object") table = b;
@ -2940,9 +2941,9 @@ if (!cluster.isPrimary) {
return res.writeHeadNodeApi(a, table); return res.writeHeadNodeApi(a, table);
} }
}; };
res.setHeader = function (headerName, headerValue) {
res.setHeader = function (a, b) { var al = headerName.toLowerCase();
if (a != "transfer-encoding" && a != "connection" && a != "keep-alive" && a != "upgrade") return res.setHeaderNodeApi(a, b); if (al != "transfer-encoding" && al != "connection" && al != "keep-alive" && al != "upgrade") return res.setHeaderNodeApi(headerName, headerValue);
return false; return false;
}; };