License: MIT
diff --git a/svr.js b/svr.js
index 2352c85..f45eb21 100644
--- a/svr.js
+++ b/svr.js
@@ -81,7 +81,7 @@ function deleteFolderRecursive(path) {
}
var os = require("os");
-var version = "3.9.1";
+var version = "3.9.2";
var singlethreaded = false;
if (process.versions) process.versions.svrjs = version; // Inject SVR.JS into process.versions
@@ -4043,7 +4043,8 @@ if (!cluster.isPrimary) {
// Sanitize URL
var sanitizedHref = sanitizeURL(href);
-
+ var preparedReqUrl = uobject.pathname + (uobject.search ? uobject.search : "") + (uobject.hash ? uobject.hash : "");
+
// Check if URL is "dirty"
if (href != sanitizedHref && !isProxy) {
var sanitizedURL = uobject;
@@ -4076,6 +4077,14 @@ if (!cluster.isPrimary) {
redirect(sanitizedURL, false);
return;
}
+ } else if(req.url != preparedReqUrl && !isProxy) {
+ serverconsole.resmessage("URL sanitized: " + req.url + " => " + preparedReqUrl);
+ if(rewriteDirtyURLs) {
+ req.url = preparedReqUrl;
+ } else {
+ redirect(preparedReqUrl, false);
+ return;
+ }
}
// Handle redirects to HTTPS
@@ -4206,7 +4215,9 @@ if (!cluster.isPrimary) {
}
var sHref = sanitizeURL(href);
- if (sHref != href.replace(/\/\.(?=\/|$)/g, "/").replace(/\/+/g, "/")) {
+ var preparedReqUrl2 = uobject.pathname + (uobject.search ? uobject.search : "") + (uobject.hash ? uobject.hash : "");
+
+ if (req.url != preparedReqUrl2 || sHref != href.replace(/\/\.(?=\/|$)/g, "/").replace(/\/+/g, "/")) {
callServerError(403);
serverconsole.errmessage("Content blocked.");
return;
diff --git a/tests.html b/tests.html
index 2a1964f..9cccfce 100644
--- a/tests.html
+++ b/tests.html
@@ -1,7 +1,7 @@
-
SVR.JS 3.9.1 Tests
+ SVR.JS 3.9.2 Tests
- SVR.JS 3.9.1 Tests
+ SVR.JS 3.9.2 Tests
Directory
Directory (with query)