Added important 418 teapot error

This commit is contained in:
Roman 2022-06-01 12:37:09 +02:00
parent ce3aa574ea
commit 8b49b26f24
2 changed files with 3 additions and 2 deletions

@ -54,6 +54,7 @@ const HTTP_STATUS_DESCRIPTIONS = [
413 => 'Request Entity Too Large', 413 => 'Request Entity Too Large',
414 => 'Request-URI Too Large', 414 => 'Request-URI Too Large',
415 => 'Unsupported Media Type', 415 => 'Unsupported Media Type',
418 => 'I\'m a teapot',
500 => 'Internal Server Error', 500 => 'Internal Server Error',
501 => 'Not Implemented', 501 => 'Not Implemented',
502 => 'Bad Gateway', 502 => 'Bad Gateway',

@ -60,8 +60,8 @@ if ($installation) {
} }
if ($router !== null) { if ($router !== null) {
if (!isset($_GET["site"]) && isset($_GET["error"]) && if ((!isset($_GET["site"]) || $_GET["site"] === "/") && isset($_GET["error"]) &&
is_string($_GET["error"]) && preg_match("^\d+$", $_GET["error"])) { is_string($_GET["error"]) && preg_match("/^\d+$/", $_GET["error"])) {
$response = $router->returnStatusCode(intval($_GET["error"])); $response = $router->returnStatusCode(intval($_GET["error"]));
} else { } else {
$response = $router->run($requestedUri); $response = $router->run($requestedUri);