diff --git a/svr.js b/svr.js index ab1ad0d..424e958 100644 --- a/svr.js +++ b/svr.js @@ -2950,16 +2950,13 @@ if (!cluster.isPrimary) { if (!req.headers.host) req.headers.host = req.headers[":authority"]; (req.headers[":path"] == undefined ? (function () {})() : req.url = req.headers[":path"]); req.protocol = req.headers[":scheme"]; - var headers = [":path", ":method"]; - for (var i = 0; i < headers.length; i++) { - if (req.headers[headers[i]] == undefined) { - var cheaders = getCustomHeaders(); - cheaders["Content-Type"] = "text/html; charset=utf-8"; - res.writeHead(400, "Bad Request", cheaders); - res.write("
The request you sent is invalid.
" + (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS").replace(/&/g, "&").replace(//g, ">") + (req.headers[":authority"] == undefined ? "" : " on " + req.headers[":authority"]) + "
"); - res.end(); - return; - } + if (req.headers[":path"] == undefined || req.headers[":method"] == undefined) { + var cheaders = getCustomHeaders(); + cheaders["Content-Type"] = "text/html; charset=utf-8"; + res.writeHead(400, "Bad Request", cheaders); + res.write("The request you sent is invalid.
" + (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS").replace(/&/g, "&").replace(//g, ">") + (req.headers[":authority"] == undefined ? "" : " on " + req.headers[":authority"]) + "
"); + res.end(); + return; } }