Prevent source code viewing by "CGI-BIN" instead of "cgi-bin" in Windows
This commit is contained in:
parent
65061c090b
commit
b584fa637c
2 changed files with 3 additions and 3 deletions
4
index.js
4
index.js
|
@ -286,7 +286,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
executeCGI("." + a, req, res, dh, nEnv);
|
executeCGI("." + a, req, res, dh, nEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (href.indexOf("/cgi-bin") == 0) {
|
if (href.match(new RegExp("/cgi-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()) {
|
||||||
|
@ -505,7 +505,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (href == "/redbrick-interpreters.json" && path.normalize(__dirname + "/../../..") == process.cwd()) {
|
} else if ((href == "/redbrick-interpreters.json" || (os.platform() == "win32" && href.toLowerCase() == "/redbrick-interpreters.json")) && path.normalize(__dirname + "/../../..") == process.cwd()) {
|
||||||
if (!callServerError) {
|
if (!callServerError) {
|
||||||
res.writeHead(200, "OK", {
|
res.writeHead(200, "OK", {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
2
mod.info
2
mod.info
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"name": "DorianTech RedBrick CGI engine for SVR.JS",
|
"name": "DorianTech RedBrick CGI engine for SVR.JS",
|
||||||
"version": "2.3.2"
|
"version": "2.3.3"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue