Merge pull request #427 from bachandi/fix_undefined_mimetype_warning

Fix warning for undefined mimetype on some http requests.
This commit is contained in:
Jordi Sanfeliu 2022-07-08 09:04:12 +02:00 committed by GitHub
commit e1f2a64fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

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