REQUEST_URI environment variable now includes rewritten URLs.

This commit is contained in:
svrjs 2023-08-02 17:25:38 +02:00
parent 58fc45fc79
commit 161fa1f980
2 changed files with 2 additions and 2 deletions

View file

@ -269,7 +269,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
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 ? decodeURI((process.cwd() + (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"] = req.url; nEnv["REQUEST_URI"] = (!origHref || origHref == href) ? req.url : (origHref + (uobject.search ? ("?" + 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, "");
nEnv["REMOTE_PORT"] = (req.socket.realRemotePort ? req.socket.realRemotePort : req.socket.remotePort); nEnv["REMOTE_PORT"] = (req.socket.realRemotePort ? req.socket.realRemotePort : req.socket.remotePort);
nEnv["SCRIPT_NAME"] = a; nEnv["SCRIPT_NAME"] = a;

View file

@ -1,4 +1,4 @@
{ {
"name": "DorianTech RedBrick CGI engine for SVR.JS", "name": "DorianTech RedBrick CGI engine for SVR.JS",
"version": "2.3.0" "version": "2.3.1"
} }