forked from svrjs/svrjs
Update to SVR.JS 3.4.36
This commit is contained in:
parent
d0a01ebe18
commit
a8249d9176
6 changed files with 29 additions and 47 deletions
|
@ -1 +0,0 @@
|
||||||
0
|
|
11
index.html
11
index.html
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.35</title>
|
<title>SVR.JS 3.4.36</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to SVR.JS 3.4.35</h1>
|
<h1>Welcome to SVR.JS 3.4.36</h1>
|
||||||
<br/>
|
<br/>
|
||||||
<img src="/logo.png" style="width: 256px;" />
|
<img src="/logo.png" style="width: 256px;" />
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
"stackHidden": false,<br/>
|
"stackHidden": false,<br/>
|
||||||
"enableRemoteLogBrowsing": false,<br/>
|
"enableRemoteLogBrowsing": false,<br/>
|
||||||
"exposeServerVersion": true,<br/>
|
"exposeServerVersion": true,<br/>
|
||||||
"disableServerSideScriptExpose": false,<br/>
|
"disableServerSideScriptExpose": true,<br/>
|
||||||
"rewriteMap": [<br/>
|
"rewriteMap": [<br/>
|
||||||
{<br/>
|
{<br/>
|
||||||
"definingRegex": "/^\\/serverSideScript\\.js(?:$|[#?])/",<br/>
|
"definingRegex": "/^\\/serverSideScript\\.js(?:$|[#?])/",<br/>
|
||||||
|
@ -119,9 +119,8 @@
|
||||||
</div>
|
</div>
|
||||||
<p>Changes:</p>
|
<p>Changes:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Added warning about worker count being limited to one when using Bun 1.0 and newer with shimmed (not native) clustering module.</li>
|
<li>Removed undocumented and non-working code.</li>
|
||||||
<li>Disabled server-side JavaScript bug workaround for Bun 1.0 and newer (it's not needed anymore for these Bun versions).</li>
|
<li>Fixed bug: .notindex files in directories no longer cause server timeouts, due of non-working undocumented code.</li>
|
||||||
<li>Improved clustering shim for Bun.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/tests.html">Tests</a><br/>
|
<a href="/tests.html">Tests</a><br/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.35 Licenses</title>
|
<title>SVR.JS 3.4.36 Licenses</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.4.35 Licenses</h1>
|
<h1>SVR.JS 3.4.36 Licenses</h1>
|
||||||
<h2>SVR.JS 3.4.35</h2>
|
<h2>SVR.JS 3.4.36</h2>
|
||||||
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
||||||
MIT License<br/>
|
MIT License<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
||||||
SOFTWARE.<br/>
|
SOFTWARE.<br/>
|
||||||
</div>
|
</div>
|
||||||
<h2>Packages used by SVR.JS 3.4.35 and utilities</h2>
|
<h2>Packages used by SVR.JS 3.4.36 and utilities</h2>
|
||||||
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
||||||
<div style="float: right;">License: MIT</div>
|
<div style="float: right;">License: MIT</div>
|
||||||
<div style="font-size: 20px;">
|
<div style="font-size: 20px;">
|
||||||
|
|
51
svr.js
51
svr.js
|
@ -71,7 +71,7 @@ function deleteFolderRecursive(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var os = require("os");
|
var os = require("os");
|
||||||
var version = "3.4.35";
|
var version = "3.4.36";
|
||||||
var singlethreaded = false;
|
var singlethreaded = false;
|
||||||
|
|
||||||
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
||||||
|
@ -3365,15 +3365,7 @@ if (!cluster.isPrimary) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version.indexOf("Nightly-") === 0 && (href == "/invoke500.svr" || (os.platform() == "win32" && href.toLowerCase() == "/invoke500.svr"))) {
|
if (allowStatus && (href == "/svrjsstatus.svr" || (os.platform() == "win32" && href.toLowerCase() == "/svrjsstatus.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"))) {
|
|
||||||
function formatRelativeTime(relativeTime) {
|
function formatRelativeTime(relativeTime) {
|
||||||
var days = Math.floor(relativeTime / 60 / (60 * 24));
|
var days = Math.floor(relativeTime / 60 / (60 * 24));
|
||||||
var dateDiff = new Date(relativeTime * 1000);
|
var dateDiff = new Date(relativeTime * 1000);
|
||||||
|
@ -3384,8 +3376,6 @@ if (!cluster.isPrimary) {
|
||||||
res.writeHead(200, "OK", hdhds);
|
res.writeHead(200, "OK", hdhds);
|
||||||
res.end((head == "" ? "<html><head><title>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /></head><body>" : head.replace(/<head>/i, "<head><title>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</title>")) + "<h1>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</h1>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") + "<br/><hr/>Current time: " + new Date().toString() + "<br/>Thread start time: " + new Date(new Date() - (process.uptime() * 1000)).toString() + "<br/>Thread uptime: " + formatRelativeTime(Math.floor(process.uptime())) + "<br/>OS uptime: " + formatRelativeTime(os.uptime()) + "<br/>Total request count: " + reqcounter + "<br/>Average request rate: " + (Math.round((reqcounter / process.uptime()) * 100) / 100) + " requests/s" + (process.memoryUsage ? ("<br/>Memory usage of thread: " + sizify(process.memoryUsage().rss) + "B") : "") + (process.cpuUsage ? ("<br/>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) + "%") : "") + "<br/>Thread PID: " + process.pid + "<br/>" + (foot == "" ? "</body></html>" : foot));
|
res.end((head == "" ? "<html><head><title>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /></head><body>" : head.replace(/<head>/i, "<head><title>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</title>")) + "<h1>SVR.JS status" + (request.headers.host == undefined ? "" : " for " + String(req.headers.host).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")) + "</h1>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") + "<br/><hr/>Current time: " + new Date().toString() + "<br/>Thread start time: " + new Date(new Date() - (process.uptime() * 1000)).toString() + "<br/>Thread uptime: " + formatRelativeTime(Math.floor(process.uptime())) + "<br/>OS uptime: " + formatRelativeTime(os.uptime()) + "<br/>Total request count: " + reqcounter + "<br/>Average request rate: " + (Math.round((reqcounter / process.uptime()) * 100) / 100) + " requests/s" + (process.memoryUsage ? ("<br/>Memory usage of thread: " + sizify(process.memoryUsage().rss) + "B") : "") + (process.cpuUsage ? ("<br/>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) + "%") : "") + "<br/>Thread PID: " + process.pid + "<br/>" + (foot == "" ? "</body></html>" : foot));
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if index file exists
|
//Check if index file exists
|
||||||
if (req.url == "/" || stats.isDirectory()) {
|
if (req.url == "/" || stats.isDirectory()) {
|
||||||
fs.stat("./" + pth + "/.notindex".replace(/\/+/g, "/"), function (e) {
|
fs.stat(("./" + pth + "/index.html").replace(/\/+/g, "/"), function (e, s) {
|
||||||
if (e) {
|
if (e || !s.isFile()) {
|
||||||
fs.stat(("./" + pth + "/index.html").replace(/\/+/g, "/"), function (e, s) {
|
fs.stat(("./" + pth + "/index.htm").replace(/\/+/g, "/"), function (e, s) {
|
||||||
if (e || !s.isFile()) {
|
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()) {
|
if (e || !s.isFile()) {
|
||||||
fs.stat(("./" + pth + "/index.xhtml").replace(/\/+/g, "/"), function (e, s) {
|
properServe()
|
||||||
if (e || !s.isFile()) {
|
|
||||||
properServe()
|
|
||||||
} else {
|
|
||||||
stats = s;
|
|
||||||
pth = (pth + "/index.xhtml").replace(/\/+/g, "/");
|
|
||||||
ext = "xhtml";
|
|
||||||
properServe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
stats = s;
|
stats = s;
|
||||||
pth = (pth + "/index.htm").replace(/\/+/g, "/");
|
pth = (pth + "/index.xhtml").replace(/\/+/g, "/");
|
||||||
ext = "htm";
|
ext = "xhtml";
|
||||||
properServe();
|
properServe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
stats = s;
|
stats = s;
|
||||||
pth = (pth + "/index.html").replace(/\/+/g, "/");
|
pth = (pth + "/index.htm").replace(/\/+/g, "/");
|
||||||
ext = "html";
|
ext = "htm";
|
||||||
properServe();
|
properServe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
stats = s;
|
||||||
|
pth = (pth + "/index.html").replace(/\/+/g, "/");
|
||||||
|
ext = "html";
|
||||||
|
properServe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -4197,9 +4184,7 @@ if (!cluster.isPrimary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
//CRASH HANDLER
|
callServerError(500, undefined, generateErrorStack(ex)); //Return 500 error
|
||||||
if (ex.message == "Intentionally crashed") throw ex; //If intentionally crashed, then crash SVR.JS
|
|
||||||
callServerError(500, undefined, generateErrorStack(ex)); //Else just return 500 error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.4.35 Tests</title>
|
<title>SVR.JS 3.4.36 Tests</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.4.35 Tests</h1>
|
<h1>SVR.JS 3.4.36 Tests</h1>
|
||||||
<h2>Directory</h2>
|
<h2>Directory</h2>
|
||||||
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
||||||
<h2>Directory (with query)</h2>
|
<h2>Directory (with query)</h2>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
0
|
|
Reference in a new issue