浏览代码

[Web] f2b banlist - add http status codes

FreddleSpl0it 2 年之前
父节点
当前提交
987cfd5dae
共有 2 个文件被更改,包括 4 次插入0 次删除
  1. 3 0
      data/web/inc/functions.fail2ban.inc.php
  2. 1 0
      data/web/inc/prerequisites.inc.php

+ 3 - 0
data/web/inc/functions.fail2ban.inc.php

@@ -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));

+ 1 - 0
data/web/inc/prerequisites.inc.php

@@ -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