Replaced error handler
This commit is contained in:
parent
f19b2e2f75
commit
cae1d77e4f
1 changed files with 2 additions and 25 deletions
27
index.js
27
index.js
|
@ -335,8 +335,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
executeCGI("." + a, req, res, dh, nEnv);
|
executeCGI("." + a, req, res, dh, nEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isCgiBin = href.match(new RegExp("/cgi-bin(?:$|[?#/])", os.platform() == "win32" ? "i" : ""));
|
||||||
if (href.match(new RegExp("/cgi-bin(?:$|[?#/])", os.platform() == "win32" ? "i" : ""))) {
|
if (isCgiBin) {
|
||||||
fs.stat("." + href, function (err, stats) {
|
fs.stat("." + href, function (err, stats) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (!stats.isFile()) {
|
if (!stats.isFile()) {
|
||||||
|
@ -590,29 +590,6 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
});
|
});
|
||||||
} else if (err && err.code == "ENOENT") {
|
} else if (err && err.code == "ENOENT") {
|
||||||
elseCallback(); //Invoke default error handler
|
elseCallback(); //Invoke default error handler
|
||||||
} else {
|
|
||||||
if (!callServerError) {
|
|
||||||
res.writeHead(500, "Internal Server Error", abheaders);
|
|
||||||
res.write(
|
|
||||||
"<html><head><title>500 Internal Server Error</title></head><body><h1>500 Internal Server Error</h1><p>A server had unexpected exception. Below, the stack trace of the error is shown:</p><code>" +
|
|
||||||
err.stack.replace(/\r\n/g, "<br/>").replace(/\n/g, "<br/>").replace(/\r/g, "<br/>").replace(/ /g, " ") +
|
|
||||||
"</code><p>Please contact the developer/administrator of the website.</p><p style=\"font-style: italic; font-weight: normal;\">SVR.JS " +
|
|
||||||
configJSON.version +
|
|
||||||
" (" +
|
|
||||||
os.platform()[0].toUpperCase() +
|
|
||||||
os.platform().slice(1) +
|
|
||||||
"; Node.JS/" +
|
|
||||||
process.version +
|
|
||||||
") RedBrick/" +
|
|
||||||
version +
|
|
||||||
" " +
|
|
||||||
(req.headers.host == undefined ? "" : " on " + req.headers.host) +
|
|
||||||
"</p></body></html>"
|
|
||||||
);
|
|
||||||
res.end();
|
|
||||||
} else {
|
|
||||||
callServerError(500, "RedBrick/" + version, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if ((href == "/redbrick-interpreters.json" || href == "/redbrick-scriptexts.json" || (os.platform() == "win32" && (href.toLowerCase() == "/redbrick-interpreters.json" || href.toLowerCase() == "/redbrick-scriptexts.json"))) && path.normalize(__dirname + "/../../..") == process.cwd()) {
|
} else if ((href == "/redbrick-interpreters.json" || href == "/redbrick-scriptexts.json" || (os.platform() == "win32" && (href.toLowerCase() == "/redbrick-interpreters.json" || href.toLowerCase() == "/redbrick-scriptexts.json"))) && path.normalize(__dirname + "/../../..") == process.cwd()) {
|
||||||
|
|
Loading…
Reference in a new issue