[Web] f2b banlist - add http status codes

This commit is contained in:
FreddleSpl0it 2023-07-11 10:31:25 +02:00
parent 1537fb39c0
commit 987cfd5dae
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5
2 changed files with 4 additions and 0 deletions

View File

@ -342,12 +342,14 @@ function fail2ban($_action, $_data = null, $_extra = null) {
'log' => array(__FUNCTION__, $_action, $_data_log, $_extra),
'msg' => array('redis_error', $e)
);
http_response_code(500);
return false;
}
if (is_array($_extra)) {
$_extra = $_extra[0];
}
if ($_extra != $f2b_options['banlist_id']){
http_response_code(404);
return false;
}
@ -363,6 +365,7 @@ function fail2ban($_action, $_data = null, $_extra = null) {
'log' => array(__FUNCTION__, $_action, $_data_log, $_extra),
'msg' => array('redis_error', $e)
);
http_response_code(500);
return false;
}
$banlist = implode("\n", array_merge($bl, $active_bans));

View File

@ -70,6 +70,7 @@ try {
}
}
catch (Exception $e) {
http_response_code(500);
?>
<center style='font-family:sans-serif;'>Connection to Redis failed.<br /><br />The following error was reported:<br/><?=$e->getMessage();?></center>
<?php