1
0
Fork 0
forked from svrjs/svrjs

Replace (...).indexOf("/") != 0 with (...)[0] != "/"

This commit is contained in:
Dorian Niemiec 2024-04-21 16:46:01 +02:00
parent 70cb113715
commit 1ae35a1977

4
svr.js
View file

@ -2984,7 +2984,7 @@ if (!cluster.isPrimary) {
}
});
var isProxy = false;
if (req.url.indexOf("/") != 0 && req.url != "*") isProxy = true;
if (req.url[0] != "/" && req.url != "*") isProxy = true;
serverconsole.locmessage("Somebody connected to " + (secure && fromMain ? ((typeof sport == "number" ? "port " : "socket ") + sport) : ((typeof port == "number" ? "port " : "socket ") + port)) + "...");
if (req.socket == null) {
@ -3314,7 +3314,7 @@ if (!cluster.isPrimary) {
if (uobject.href != "") nuobject.href = uobject.href;
// Adjust the pathname and href properties if the URI doesn't start with "/"
if (preparedURI.indexOf("/") != 0) {
if (preparedURI[0] != "/") {
if (nuobject.pathname) {
nuobject.pathname = nuobject.pathname.substring(1);
nuobject.href = nuobject.pathname + (nuobject.search ? nuobject.search : "");