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>
|
||||
<html>
|
||||
<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 charset="UTF-8" />
|
||||
<style>
|
||||
|
@ -12,7 +12,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to SVR.JS 3.4.35</h1>
|
||||
<h1>Welcome to SVR.JS 3.4.36</h1>
|
||||
<br/>
|
||||
<img src="/logo.png" style="width: 256px;" />
|
||||
<br/>
|
||||
|
@ -38,7 +38,7 @@
|
|||
"stackHidden": false,<br/>
|
||||
"enableRemoteLogBrowsing": false,<br/>
|
||||
"exposeServerVersion": true,<br/>
|
||||
"disableServerSideScriptExpose": false,<br/>
|
||||
"disableServerSideScriptExpose": true,<br/>
|
||||
"rewriteMap": [<br/>
|
||||
{<br/>
|
||||
"definingRegex": "/^\\/serverSideScript\\.js(?:$|[#?])/",<br/>
|
||||
|
@ -119,9 +119,8 @@
|
|||
</div>
|
||||
<p>Changes:</p>
|
||||
<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>Disabled server-side JavaScript bug workaround for Bun 1.0 and newer (it's not needed anymore for these Bun versions).</li>
|
||||
<li>Improved clustering shim for Bun.</li>
|
||||
<li>Removed undocumented and non-working code.</li>
|
||||
<li>Fixed bug: .notindex files in directories no longer cause server timeouts, due of non-working undocumented code.</li>
|
||||
</ul>
|
||||
<br/>
|
||||
<a href="/tests.html">Tests</a><br/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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 charset="UTF-8" />
|
||||
<style>
|
||||
|
@ -12,8 +12,8 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>SVR.JS 3.4.35 Licenses</h1>
|
||||
<h2>SVR.JS 3.4.35</h2>
|
||||
<h1>SVR.JS 3.4.36 Licenses</h1>
|
||||
<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;">
|
||||
MIT License<br/>
|
||||
<br/>
|
||||
|
@ -37,7 +37,7 @@
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
||||
SOFTWARE.<br/>
|
||||
</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="float: right;">License: MIT</div>
|
||||
<div style="font-size: 20px;">
|
||||
|
|
23
svr.js
23
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 == "" ? "<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;
|
||||
} else if (version.indexOf("Nightly-") === 0 && (href == "/crash.svr" || (os.platform() == "win32" && href.toLowerCase() == "/crash.svr"))) {
|
||||
throw new Error("Intentionally crashed");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
@ -3416,10 +3406,9 @@ 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) {
|
||||
if (e || !s.isFile()) {
|
||||
fs.stat(("./" + pth + "/index.htm").replace(/\/+/g, "/"), function (e, s) {
|
||||
|
@ -3448,8 +3437,6 @@ if (!cluster.isPrimary) {
|
|||
properServe();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
properServe();
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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 charset="UTF-8" />
|
||||
<style>
|
||||
|
@ -12,7 +12,7 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>SVR.JS 3.4.35 Tests</h1>
|
||||
<h1>SVR.JS 3.4.36 Tests</h1>
|
||||
<h2>Directory</h2>
|
||||
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
||||
<h2>Directory (with query)</h2>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
0
|
Reference in a new issue