From dfe13d711eb4978bcd01ba8fd4093b8c7791283f Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 3 Dec 2023 21:11:07 +0100 Subject: [PATCH] Fixed bug with too long URLs causing server to not respond. Also added support for exposeModsInErrorPages config.json property. --- index.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 0ed3413..6a59bbb 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,8 @@ try { } +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); + function Mod() {} Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, ext, uobject, search, defaultpage, users, page404, head, foot, fd, elseCallback, configJSON, callServerError, getCustomHeaders, origHref, redirect, parsePostData) { @@ -379,8 +381,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e req.socket.localPort, getCustomHeaders ? getCustomHeaders()["Server"] + + (disableModExposeSupported && (configJSON.exposeModsInErrorPages || configJSON.exposeModsInErrorPages === undefined) ? " RedBrick/" + - version : + version : "") : "SVR.JS/" + configJSON.version + " (" + @@ -429,8 +432,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e req.socket.localPort, getCustomHeaders ? getCustomHeaders()["Server"] + + (disableModExposeSupported && (configJSON.exposeModsInErrorPages || configJSON.exposeModsInErrorPages === undefined) ? " RedBrick/" + - version : + version : "") : "SVR.JS/" + configJSON.version + " (" + @@ -487,8 +491,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e req.socket.localPort, getCustomHeaders ? getCustomHeaders()["Server"] + + (disableModExposeSupported && (configJSON.exposeModsInErrorPages || configJSON.exposeModsInErrorPages === undefined) ? " RedBrick/" + - version : + version : "") : "SVR.JS/" + configJSON.version + " (" + @@ -543,8 +548,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e req.socket.localPort, getCustomHeaders ? getCustomHeaders()["Server"] + + (disableModExposeSupported && (configJSON.exposeModsInErrorPages || configJSON.exposeModsInErrorPages === undefined) ? " RedBrick/" + - version : + version : "") : "SVR.JS/" + configJSON.version + " (" + @@ -623,8 +629,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e req.socket.localPort, getCustomHeaders ? getCustomHeaders()["Server"] + + (disableModExposeSupported && (configJSON.exposeModsInErrorPages || configJSON.exposeModsInErrorPages === undefined) ? " RedBrick/" + - version : + version : "") : "SVR.JS/" + configJSON.version + " (" + @@ -665,7 +672,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e } } }); - } else if (err && err.code == "ENOENT") { + } else { elseCallback(); //Invoke default error handler } });