Fixed bug with URLs containing URL-encoded characters

This commit is contained in:
Dorian Niemiec 2024-01-29 18:56:33 +00:00
parent 4e5ab8184d
commit f03f82dbe4

View file

@ -204,8 +204,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["SCRIPT_NAME"] = scgiConf.path; nEnv["SCRIPT_NAME"] = scgiConf.path;
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["SCGI"] = "1"; nEnv["SCGI"] = "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) : ""));
@ -232,7 +232,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
if (href == scgiConf.path || href.indexOf(scgiConf.path + "/") == 0) { if (href == scgiConf.path || href.indexOf(scgiConf.path + "/") == 0) {
try { try {
executeSCGIWithEnv( executeSCGIWithEnv(
href, decodeURIComponent(href),
req, req,
res, res,
req.socket.localAddress, req.socket.localAddress,