Fix warning for undefined mimetype on some http requests.

This commit is contained in:
Andreas Bachlechner 2022-07-05 22:03:54 +02:00
parent 53569ee617
commit 95dbed04e5
1 changed files with 10 additions and 8 deletions

View File

@ -167,6 +167,7 @@ sub http_header {
print "Server: Monitorix HTTP Server\r\n";
print "Connection: close\r\n";
if (defined($mimetype)) {
if($mimetype =~ m/(html|cgi)/) {
print "Content-Type: text/html; charset=UTF-8\r\n";
} elsif($mimetype eq "css") {
@ -176,6 +177,7 @@ sub http_header {
} else {
print "Content-Type: image/$mimetype;\r\n";
}
}
print "\r\n";
return 0;