diff --git a/index.html b/index.html index 17e38c0..288ba91 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@
-Changes:
Tests
diff --git a/licenses/index.html b/licenses/index.html
index d9ede85..fc74aab 100644
--- a/licenses/index.html
+++ b/licenses/index.html
@@ -1,7 +1,7 @@
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; - } + } else { + return res.writeHeadNodeApi(a, table); } - } catch (err) { - var cheaders = getCustomHeaders(); - cheaders["Content-Type"] = "text/html; charset=utf-8"; - cheaders[":status"] = "500"; - res.stream.respond(cheaders); - res.stream.write("The server had an unexpected error. Below, error stack is shown:
" + (stackHidden ? "[error stack hidden]" : generateErrorStack(err)).replace(/\r\n/g, "
").replace(/\n/g, "
").replace(/\r/g, "
").replace(/ {2}/g, " ") + "
Please contact with developer/administrator of the website.
" + (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.stream.end(); - return; + }; + 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; + }; + + // Set HTTP/1.x headers + if (!req.headers.host) req.headers.host = req.headers[":authority"]; + if (!req.url) req.url = req.headers[":path"]; + if (!req.protocol) req.protocol = req.headers[":scheme"]; + if (!req.method) req.method = req.headers[":method"]; + if (req.headers[":path"] == undefined || req.headers[":method"] == undefined) { + var err = new Error("Either \":path\" or \":method\" pseudoheader is missing."); + if(Buffer.alloc) err.rawPacket = Buffer.alloc(0); + reqerrhandler(err, req.socket, fromMain); } } @@ -4240,12 +4222,13 @@ if (!cluster.isPrimary) { // Handle redirects to addresses with "www." prefix if (wwwredirect) { - var hostname = req.headers.host.split[":"]; + var hostname = req.headers.host.split(":"); var hostport = null; if (hostname.length > 1 && (hostname[0] != "[" || hostname[hostname.length - 1] != "]")) hostport = hostname.pop(); hostname = hostname.join(":"); if (hostname == domain && hostname.indexOf("www.") != 0) { redirect((req.socket.encrypted ? "https" : "http") + "://www." + hostname + (hostport ? ":" + hostport : "") + req.url.replace(/\/+/g, "/")); + return; } } diff --git a/tests.html b/tests.html index a6a864c..3ef3565 100644 --- a/tests.html +++ b/tests.html @@ -1,7 +1,7 @@ -