1
0
Fork 0
forked from svrjs/svrjs

Map ENAMETOOLONG to 414 code

This commit is contained in:
Dorian Niemiec 2023-08-21 19:38:38 +02:00
parent 54ba71212b
commit 2d266bf1b3

19
svr.js
View file

@ -2175,6 +2175,8 @@ if (!cluster.isPrimary) {
additionalError = 404; // Assume that file doesn't exist additionalError = 404; // Assume that file doesn't exist
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
additionalError = 403; additionalError = 403;
} else if (err.code == "ENAMETOOLONG") {
additionalError = 414;
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
additionalError = 503; additionalError = 503;
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -2574,6 +2576,8 @@ if (!cluster.isPrimary) {
additionalError = 404; // Assume that file doesn't exist additionalError = 404; // Assume that file doesn't exist
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
additionalError = 403; additionalError = 403;
} else if (err.code == "ENAMETOOLONG") {
additionalError = 414;
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
additionalError = 503; additionalError = 503;
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -3246,6 +3250,8 @@ if (!cluster.isPrimary) {
additionalError = 404; // Assume that file doesn't exist additionalError = 404; // Assume that file doesn't exist
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
additionalError = 403; additionalError = 403;
} else if (err.code == "ENAMETOOLONG") {
additionalError = 414;
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
additionalError = 503; additionalError = 503;
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -3610,6 +3616,9 @@ if (!cluster.isPrimary) {
callServerError(403); callServerError(403);
serverconsole.errmessage("Access denied."); serverconsole.errmessage("Access denied.");
return; return;
} else if (err.code == "ENAMETOOLONG") {
callServerError(414);
return;
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
callServerError(503); callServerError(503);
return; return;
@ -3882,6 +3891,8 @@ if (!cluster.isPrimary) {
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
callServerError(403); callServerError(403);
serverconsole.errmessage("Access denied."); serverconsole.errmessage("Access denied.");
} else if (err.code == "ENAMETOOLONG") {
callServerError(414);
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
callServerError(503); callServerError(503);
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -3915,6 +3926,8 @@ if (!cluster.isPrimary) {
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
callServerError(403); callServerError(403);
serverconsole.errmessage("Access denied."); serverconsole.errmessage("Access denied.");
} else if (err.code == "ENAMETOOLONG") {
callServerError(414);
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
callServerError(503); callServerError(503);
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -4036,6 +4049,8 @@ if (!cluster.isPrimary) {
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
callServerError(403); callServerError(403);
serverconsole.errmessage("Access denied."); serverconsole.errmessage("Access denied.");
} else if (err.code == "ENAMETOOLONG") {
callServerError(414);
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
callServerError(503); callServerError(503);
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -4095,6 +4110,8 @@ if (!cluster.isPrimary) {
} else if (err.code == "EACCES") { } else if (err.code == "EACCES") {
callServerError(403); callServerError(403);
serverconsole.errmessage("Access denied."); serverconsole.errmessage("Access denied.");
} else if (err.code == "ENAMETOOLONG") {
callServerError(414);
} else if (err.code == "EMFILE") { } else if (err.code == "EMFILE") {
callServerError(503); callServerError(503);
} else if (err.code == "ELOOP") { } else if (err.code == "ELOOP") {
@ -5037,7 +5054,7 @@ function start(init) {
scryptCache = scryptCache.filter(function(entry) { scryptCache = scryptCache.filter(function(entry) {
return entry.addDate > (new Date() - 3600000); return entry.addDate > (new Date() - 3600000);
}); });
}, 10000); }, 1800000);
} }
if (!cluster.isPrimary && cluster.isPrimary !== undefined) { if (!cluster.isPrimary && cluster.isPrimary !== undefined) {
process.on("message", function (line) { process.on("message", function (line) {