Overloaded FastCGI server now results in 429 Too Many Requests status code.
This commit is contained in:
parent
067e54e8a2
commit
82f41e837e
1 changed files with 8 additions and 1 deletions
9
index.js
9
index.js
|
@ -436,7 +436,14 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
|||
|
||||
handler = createFastCGIHandler(options);
|
||||
handler.on("error", function (error) {
|
||||
var errorcode = (error.code == "ENOTFOUND" || error.code == "EHOSTUNREACH" || error.code == "ECONNREFUSED") ? 503 : 500;
|
||||
var errorcode = 0;
|
||||
if (error.code == "ENOTFOUND" || error.code == "EHOSTUNREACH" || error.code == "ECONNREFUSED") {
|
||||
errorcode = 503;
|
||||
} else if (error.code == "EMFILE") {
|
||||
errorcode = 429;
|
||||
} else {
|
||||
errorcode = 500;
|
||||
}
|
||||
if (!callServerError) {
|
||||
res.writeHead(errorcode, {
|
||||
"Content-Type": "text/html",
|
||||
|
|
Loading…
Reference in a new issue