diff --git a/hviews.txt b/hviews.txt
deleted file mode 100644
index 573541a..0000000
--- a/hviews.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/index.html b/index.html
index 9ffa673..387a800 100644
--- a/index.html
+++ b/index.html
@@ -1,7 +1,7 @@
-
License: MIT
diff --git a/svr.js b/svr.js
index 885970f..c02951e 100644
--- a/svr.js
+++ b/svr.js
@@ -71,7 +71,7 @@ function deleteFolderRecursive(path) {
}
var os = require("os");
-var version = "3.4.35";
+var version = "3.4.36";
var singlethreaded = false;
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
@@ -3365,15 +3365,7 @@ if (!cluster.isPrimary) {
return;
}
- if (version.indexOf("Nightly-") === 0 && (href == "/invoke500.svr" || (os.platform() == "win32" && href.toLowerCase() == "/invoke500.svr"))) {
- if (uobject.query.crash !== undefined) throw new Error("Intentionally crashed");
- try {
- throw new Error("This page is intended to return 500 code.");
- } catch (ex) {
- callServerError(500, undefined, generateErrorStack(ex));
- return;
- }
- } else if (allowStatus && (href == "/svrjsstatus.svr" || (os.platform() == "win32" && href.toLowerCase() == "/svrjsstatus.svr"))) {
+ if (allowStatus && (href == "/svrjsstatus.svr" || (os.platform() == "win32" && href.toLowerCase() == "/svrjsstatus.svr"))) {
function formatRelativeTime(relativeTime) {
var days = Math.floor(relativeTime / 60 / (60 * 24));
var dateDiff = new Date(relativeTime * 1000);
@@ -3384,8 +3376,6 @@ if (!cluster.isPrimary) {
res.writeHead(200, "OK", hdhds);
res.end((head == "" ? "
SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(//g, ">")) + "" : head.replace(//i, "SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(//g, ">")) + "")) + "SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(//g, ">")) + "
Server version: " + (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS") + "
Current time: " + new Date().toString() + "
Thread start time: " + new Date(new Date() - (process.uptime() * 1000)).toString() + "
Thread uptime: " + formatRelativeTime(Math.floor(process.uptime())) + "
OS uptime: " + formatRelativeTime(os.uptime()) + "
Total request count: " + reqcounter + "
Average request rate: " + (Math.round((reqcounter / process.uptime()) * 100) / 100) + " requests/s" + (process.memoryUsage ? ("
Memory usage of thread: " + sizify(process.memoryUsage().rss) + "B") : "") + (process.cpuUsage ? ("
Total CPU usage by thread: u" + (process.cpuUsage().user / 1000) + "ms s" + (process.cpuUsage().system / 1000) + "ms - " + (Math.round((((process.cpuUsage().user + process.cpuUsage().system) / 1000000) / process.uptime()) * 1000) / 1000) + "%") : "") + "
Thread PID: " + process.pid + "
" + (foot == "" ? "" : foot));
return;
- } else if (version.indexOf("Nightly-") === 0 && (href == "/crash.svr" || (os.platform() == "win32" && href.toLowerCase() == "/crash.svr"))) {
- throw new Error("Intentionally crashed");
}
/////////////////////////////////////////////
@@ -3416,38 +3406,35 @@ if (!cluster.isPrimary) {
}
return;
}
+
//Check if index file exists
if (req.url == "/" || stats.isDirectory()) {
- fs.stat("./" + pth + "/.notindex".replace(/\/+/g, "/"), function (e) {
- if (e) {
- fs.stat(("./" + pth + "/index.html").replace(/\/+/g, "/"), function (e, s) {
+ fs.stat(("./" + pth + "/index.html").replace(/\/+/g, "/"), function (e, s) {
+ if (e || !s.isFile()) {
+ fs.stat(("./" + pth + "/index.htm").replace(/\/+/g, "/"), function (e, s) {
if (e || !s.isFile()) {
- fs.stat(("./" + pth + "/index.htm").replace(/\/+/g, "/"), function (e, s) {
+ fs.stat(("./" + pth + "/index.xhtml").replace(/\/+/g, "/"), function (e, s) {
if (e || !s.isFile()) {
- fs.stat(("./" + pth + "/index.xhtml").replace(/\/+/g, "/"), function (e, s) {
- if (e || !s.isFile()) {
- properServe()
- } else {
- stats = s;
- pth = (pth + "/index.xhtml").replace(/\/+/g, "/");
- ext = "xhtml";
- properServe();
- }
- });
+ properServe()
} else {
stats = s;
- pth = (pth + "/index.htm").replace(/\/+/g, "/");
- ext = "htm";
+ pth = (pth + "/index.xhtml").replace(/\/+/g, "/");
+ ext = "xhtml";
properServe();
}
});
} else {
stats = s;
- pth = (pth + "/index.html").replace(/\/+/g, "/");
- ext = "html";
+ pth = (pth + "/index.htm").replace(/\/+/g, "/");
+ ext = "htm";
properServe();
}
});
+ } else {
+ stats = s;
+ pth = (pth + "/index.html").replace(/\/+/g, "/");
+ ext = "html";
+ properServe();
}
});
} else {
@@ -4197,9 +4184,7 @@ if (!cluster.isPrimary) {
}
}
} catch (ex) {
- //CRASH HANDLER
- if (ex.message == "Intentionally crashed") throw ex; //If intentionally crashed, then crash SVR.JS
- callServerError(500, undefined, generateErrorStack(ex)); //Else just return 500 error
+ callServerError(500, undefined, generateErrorStack(ex)); //Return 500 error
}
}
diff --git a/tests.html b/tests.html
index 850863d..f669f86 100644
--- a/tests.html
+++ b/tests.html
@@ -1,7 +1,7 @@
- SVR.JS 3.4.35 Tests
+ SVR.JS 3.4.36 Tests
- SVR.JS 3.4.35 Tests
+ SVR.JS 3.4.36 Tests
Directory
Directory (with query)
diff --git a/views.txt b/views.txt
deleted file mode 100644
index 573541a..0000000
--- a/views.txt
+++ /dev/null
@@ -1 +0,0 @@
-0