chore: release GreenRhombus 1.1.1

This commit is contained in:
Dorian Niemiec 2024-12-09 15:48:58 +01:00
parent a1b58be89e
commit c985a3fc3c
2 changed files with 24 additions and 9 deletions

View file

@ -355,6 +355,19 @@ if (typeof fastcgiConfO.multiConfig == "object" && fastcgiConfO.multiConfig !==
} }
var disableModExposeSupported = process.versions.svrjs && process.versions.svrjs.match(/^(?:Nightly-|(?:[4-9]|[123][0-9])[0-9]*\.|3\.(?:[1-9][0-9]+\.|9\.(?:[1-9])|4\.(?:(?:[3-9]|[12][0-9])[0-9]+|29)))/i); var disableModExposeSupported = process.versions.svrjs && process.versions.svrjs.match(/^(?:Nightly-|(?:[4-9]|[123][0-9])[0-9]*\.|3\.(?:[1-9][0-9]+\.|9\.(?:[1-9])|4\.(?:(?:[3-9]|[12][0-9])[0-9]+|29)))/i);
var normalizedWebrootSupported = process.versions.svrjs && process.versions.svrjs.match(/^(?:Nightly-|(?:[5-9]|[1234][0-9])[0-9]*\.|4\.(?:(?:[1][0-9]|[2-9])+\.))/i);
function normalizeWebroot(currentWebroot) {
if (currentWebroot === undefined) {
return process.cwd();
} else if (!path.isAbsolute(currentWebroot)) {
return (
process.cwd() + (os.platform() == "win32" ? "\\" : "/") + currentWebroot
);
} else {
return currentWebroot;
}
}
function Mod() {} function Mod() {}
@ -364,6 +377,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
configJSON = configJSONS; configJSON = configJSONS;
} }
var detectedWwwroot = normalizedWebrootSupported ? normalizeWebroot(configJSON.wwwroot) : process.cwd();
function checkIfThereIsA401Rule() { function checkIfThereIsA401Rule() {
var actually401 = false; var actually401 = false;
@ -600,11 +615,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
nEnv["SERVER_ADMIN"] = configJSON.serverAdministratorEmail; nEnv["SERVER_ADMIN"] = configJSON.serverAdministratorEmail;
} }
nEnv["SERVER_NAME"] = req.headers.host; nEnv["SERVER_NAME"] = req.headers.host;
nEnv["DOCUMENT_ROOT"] = process.cwd(); nEnv["DOCUMENT_ROOT"] = detectedWwwroot;
nEnv["SCRIPT_NAME"] = cPath; nEnv["SCRIPT_NAME"] = cPath;
nEnv["SCRIPT_FILENAME"] = (process.cwd() + (require("os").platform == "win32" ? cPath.replace(/\//g, "\\") : cPath)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/")); nEnv["SCRIPT_FILENAME"] = (detectedWwwroot + (require("os").platform == "win32" ? cPath.replace(/\//g, "\\") : cPath)).replace((require("os").platform == "win32" ? /\\\\/g : /\/\//g), (require("os").platform == "win32" ? "\\" : "/"));
nEnv["PATH_INFO"] = decodeURIComponent(b); nEnv["PATH_INFO"] = decodeURIComponent(b);
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["PATH_TRANSLATED"] = b ? ((detectedWwwroot + 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["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ((uobject.search[0] == "?" ? "" : "?") + uobject.search) : "")); nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ((uobject.search[0] == "?" ? "" : "?") + uobject.search) : ""));
nEnv["REMOTE_ADDR"] = (req.socket.realRemoteAddress ? req.socket.realRemoteAddress : ((req.headers["x-forwarded-for"] && configJSON.enableIPSpoofing) ? req.headers["x-forwarded-for"].split(",")[0].replace(/ /g, "") : req.socket.remoteAddress)).replace(/^::ffff:/i, ""); nEnv["REMOTE_ADDR"] = (req.socket.realRemoteAddress ? req.socket.realRemoteAddress : ((req.headers["x-forwarded-for"] && configJSON.enableIPSpoofing) ? req.headers["x-forwarded-for"].split(",")[0].replace(/ /g, "") : req.socket.remoteAddress)).replace(/^::ffff:/i, "");
@ -701,7 +716,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
callServerError(500, "GreenRhombus/" + version, ex); callServerError(500, "GreenRhombus/" + version, ex);
} }
} }
} else if (((href == "/greenrhombus-config.json" || (os.platform() == "win32" && href.toLowerCase() == "/greenrhombus-config.json")) && path.normalize(__dirname + "/../../..") == process.cwd()) || ((href == "/greenrhombus-scriptexts.json" || (os.platform() == "win32" && href.toLowerCase() == "/greenrhombus-scriptexts.json")) && path.normalize(__dirname + "/../../..") == process.cwd())) { } else if (((href == "/greenrhombus-config.json" || (os.platform() == "win32" && href.toLowerCase() == "/greenrhombus-config.json")) && path.normalize(__dirname + "/../../..") == detectedWwwroot) || ((href == "/greenrhombus-scriptexts.json" || (os.platform() == "win32" && href.toLowerCase() == "/greenrhombus-scriptexts.json")) && path.normalize(__dirname + "/../../..") == detectedWwwroot)) {
if (!callServerError) { if (!callServerError) {
res.writeHead(200, "OK", { res.writeHead(200, "OK", {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -712,11 +727,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
callServerError(200, "GreenRhombus/" + version, exttointerpreteruser); callServerError(200, "GreenRhombus/" + version, exttointerpreteruser);
} }
} else { } else {
fs.stat("." + decodeURIComponent(href), function (err, stats) { fs.stat(detectedWwwroot + decodeURIComponent(href), function (err, stats) {
if (!err) { if (!err) {
if (!stats.isFile()) { if (!stats.isFile()) {
if (scriptExts.indexOf(".php") != -1) { if (scriptExts.indexOf(".php") != -1) {
fs.stat("." + decodeURIComponent(href) + "/index.php", function (e2, s2) { fs.stat(detectedWwwroot + decodeURIComponent(href) + "/index.php", function (e2, s2) {
if (!e2 && s2.isFile()) { if (!e2 && s2.isFile()) {
try { try {
executeFastCGIWithEnv( executeFastCGIWithEnv(
@ -774,7 +789,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
}); });
} else if (scriptExts.indexOf(".cgi") != -1) { } else if (scriptExts.indexOf(".cgi") != -1) {
fs.stat("." + decodeURIComponent(href) + "/index.cgi", function (e3, s3) { fs.stat(detectedWwwroot + decodeURIComponent(href) + "/index.cgi", function (e3, s3) {
if (!e3 && s3.isFile()) { if (!e3 && s3.isFile()) {
try { try {
executeFastCGIWithEnv( executeFastCGIWithEnv(
@ -902,7 +917,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
if (!a) b = []; if (!a) b = [];
else var b = a.split("/"); else var b = a.split("/");
var isFile = false; var isFile = false;
fs.stat(pth, function (err, stats) { fs.stat(detectedWwwroot + "/" + pth, function (err, stats) {
if (!err && stats.isFile()) { if (!err && stats.isFile()) {
cb({ cb({
fpth: pth, fpth: pth,

View file

@ -1,4 +1,4 @@
{ {
"name": "GreenRhombus FastCGI client for SVR.JS", "name": "GreenRhombus FastCGI client for SVR.JS",
"version": "1.1.0" "version": "1.1.1"
} }