Update to RedBrick 2.5.3

This commit is contained in:
Dorian Niemiec 2024-01-29 18:52:47 +00:00
parent 542d8fa8c5
commit 0d67e50463
2 changed files with 12 additions and 12 deletions

View file

@ -317,8 +317,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
nEnv["SERVER_NAME"] = req.headers.host; nEnv["SERVER_NAME"] = req.headers.host;
nEnv["DOCUMENT_ROOT"] = process.cwd(); nEnv["DOCUMENT_ROOT"] = process.cwd();
nEnv["PATH_INFO"] = decodeURI(b); nEnv["PATH_INFO"] = decodeURIComponent(b);
nEnv["PATH_TRANSLATED"] = b ? decodeURI((process.cwd() + (require("os").platform == "win32" ? b.replace(/\//g, "\\") : b)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/"))) : ""; nEnv["PATH_TRANSLATED"] = b ? ((process.cwd() + decodeURIComponent(require("os").platform == "win32" ? b.replace(/\//g, "\\") : b)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/"))) : "";
nEnv["REQUEST_METHOD"] = req.method; nEnv["REQUEST_METHOD"] = req.method;
nEnv["GATEWAY_INTERFACE"] = "CGI/1.1"; nEnv["GATEWAY_INTERFACE"] = "CGI/1.1";
nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ("?" + uobject.search) : "")); nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ("?" + uobject.search) : ""));
@ -371,15 +371,15 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
callServerError(403, "RedBrick/" + version); callServerError(403, "RedBrick/" + version);
} }
} else { } else {
fs.stat("." + href, function (err, stats) { fs.stat("." + decodeURIComponent(href), function (err, stats) {
if (!err) { if (!err) {
if (!stats.isFile()) { if (!stats.isFile()) {
if (isCgiBin || scriptExts.indexOf(".php") != -1) { if (isCgiBin || scriptExts.indexOf(".php") != -1) {
fs.stat("." + href + "/index.php", function (e2, s2) { fs.stat("." + decodeURIComponent(href) + "/index.php", function (e2, s2) {
if (!e2 && s2.isFile()) { if (!e2 && s2.isFile()) {
try { try {
executeCGIWithEnv( executeCGIWithEnv(
(href + "/index.php").replace(/\/+/g, "/"), (decodeURIComponent(href) + "/index.php").replace(/\/+/g, "/"),
"", "",
req, req,
res, res,
@ -426,11 +426,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
} }
} else if (isCgiBin || scriptExts.indexOf(".cgi") != -1) { } else if (isCgiBin || scriptExts.indexOf(".cgi") != -1) {
fs.stat("." + href + "/index.cgi", function (e3, s3) { fs.stat("." + decodeURIComponent(href) + "/index.cgi", function (e3, s3) {
if (!e3 && s3.isFile()) { if (!e3 && s3.isFile()) {
try { try {
executeCGIWithEnv( executeCGIWithEnv(
(href + "/index.cgi").replace(/\/+/g, "/"), (decodeURIComponent(href) + "/index.cgi").replace(/\/+/g, "/"),
"", "",
req, req,
res, res,
@ -485,11 +485,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
}); });
} else if (scriptExts.indexOf(".cgi") != -1) { } else if (scriptExts.indexOf(".cgi") != -1) {
fs.stat("." + href + "/index.cgi", function (e3, s3) { fs.stat("." + decodeURIComponent(href) + "/index.cgi", function (e3, s3) {
if (!e3 && s3.isFile()) { if (!e3 && s3.isFile()) {
try { try {
executeCGIWithEnv( executeCGIWithEnv(
(href + "/index.cgi").replace(/\/+/g, "/"), (decodeURIComponent(href) + "/index.cgi").replace(/\/+/g, "/"),
"", "",
req, req,
res, res,
@ -546,7 +546,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
if (isCgiBin || isScriptExt) { if (isCgiBin || isScriptExt) {
try { try {
executeCGIWithEnv( executeCGIWithEnv(
href, decodeURIComponent(href),
"", "",
req, req,
res, res,
@ -619,7 +619,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
}); });
} }
checkPath("." + href, function (pathp) { checkPath("." + decodeURIComponent(href), function (pathp) {
if (!pathp) { if (!pathp) {
elseCallback(); elseCallback();
} else { } else {

View file

@ -1,4 +1,4 @@
{ {
"name": "RedBrick CGI engine for SVR.JS", "name": "RedBrick CGI engine for SVR.JS",
"version": "2.5.2" "version": "2.5.3"
} }