public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] fix wrong content type + add more http 500 responses
db2759b7
data/web/inc/prerequisites.inc.php | 3 +++
data/web/json_api.php | 2 ++
2 files changed, 5 insertions(+)
Diff
diff --git a/data/web/inc/prerequisites.inc.php b/data/web/inc/prerequisites.inc.php
index f7fd80b4..9c5203e7 100644
--- a/data/web/inc/prerequisites.inc.php
+++ b/data/web/inc/prerequisites.inc.php
@@ -70,6 +70,7 @@ try {
}
}
catch (Exception $e) {
+// Stop when redis is not available
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>
@@ -99,6 +100,7 @@ try {
}
catch (PDOException $e) {
// Stop when SQL connection fails
+http_response_code(500);
?>
<center style='font-family:sans-serif;'>Connection to database failed.<br /><br />The following error was reported:<br/> <?=$e->getMessage();?></center>
<?php
@@ -106,6 +108,7 @@ exit;
}
// Stop when dockerapi is not available
if (fsockopen("tcp://dockerapi", 443, $errno, $errstr) === false) {
+ http_response_code(500);
?>
<center style='font-family:sans-serif;'>Connection to dockerapi container failed.<br /><br />The following error was reported:<br/><?=$errno;?> - <?=$errstr;?></center>
<?php
diff --git a/data/web/json_api.php b/data/web/json_api.php
index 50a45b56..029d9931 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -508,6 +508,7 @@ if (isset($_GET['query'])) {
if (!isset($_SESSION['mailcow_cc_role'])){
switch ($object) {
case 'banlist':
+ header('Content-Type: text/plain');
echo fail2ban('banlist', 'get', $extra);
break;
}
@@ -1334,6 +1335,7 @@ if (isset($_GET['query'])) {
case "fail2ban":
switch ($object) {
case 'banlist':
+ header('Content-Type: text/plain');
echo fail2ban('banlist', 'get', $extra);
break;
default: