From f03f82dbe4c4199beae271acc679fee4fd7bb819 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Mon, 29 Jan 2024 18:56:33 +0000 Subject: [PATCH] Fixed bug with URLs containing URL-encoded characters --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 50929dc..af2fc18 100644 --- a/index.js +++ b/index.js @@ -204,8 +204,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e nEnv["SERVER_NAME"] = req.headers.host; nEnv["DOCUMENT_ROOT"] = process.cwd(); nEnv["SCRIPT_NAME"] = scgiConf.path; - nEnv["PATH_INFO"] = decodeURI(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_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["REQUEST_METHOD"] = req.method; nEnv["SCGI"] = "1"; 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) { try { executeSCGIWithEnv( - href, + decodeURIComponent(href), req, res, req.socket.localAddress,