Prevent source code viewing by "JSGI-BIN" instead of "jsgi-bin" in Windows

This commit is contained in:
Dorian Niemiec 2023-08-14 18:14:17 +02:00
parent 00073379d4
commit 534edc1eb8
2 changed files with 2 additions and 12 deletions

View file

@ -188,7 +188,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
executeJSGI("." + a, req, res, dh, jsgiRequestObject); executeJSGI("." + a, req, res, dh, jsgiRequestObject);
} }
if (href.indexOf("/jsgi-bin") == 0) { if (href.match(new RegExp("/jsgi-bin(?:$|[?#/])",os.platform() == "win32" ? "i" : ""))) {
fs.stat("." + href, function (err, stats) { fs.stat("." + href, function (err, stats) {
if (!err) { if (!err) {
if (!stats.isFile()) { if (!stats.isFile()) {
@ -345,16 +345,6 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
} }
}); });
} else if (href == "/YellowSquare-interpreters.json" && path.normalize(__dirname + "/../../..") == process.cwd()) {
if (!callServerError) {
res.writeHead(200, "OK", {
"Content-Type": "application/json",
"Server": "YellowSquare/" + version
});
res.end(JSON.stringify(exttointerpreteruser, null, 2));
} else {
callServerError(200, "YellowSquare/" + version, exttointerpreteruser);
}
} else { } else {
elseCallback(); elseCallback();
} }

View file

@ -1,4 +1,4 @@
{ {
"name": "DorianTech YellowSquare JSGI engine for SVR.JS", "name": "DorianTech YellowSquare JSGI engine for SVR.JS",
"version": "1.0.0" "version": "1.0.1"
} }