Webserver GetFileType changed

master
Steffen Pohle 3 weeks ago
parent 6463e8edc8
commit 8dafd5b2f4

@ -1,3 +1,7 @@
2026-11-08:
- WebServerClient::GetFileType is not comparing for the file extension, but more
if it contains some words like .jpg, or .html
2026-10-24:
- tcp.cc: on hosts with disabled ipv6, we could not listen on IPV4 only

@ -176,14 +176,14 @@ std::string WebServerClient::GetFileType (std::string fname) {
std::string suffix = string_to_lower (fname.substr(pos));
if (suffix.compare (".html") == 0) return res;
if (suffix.compare (".htm") == 0) return res;
if (suffix.compare (".js") == 0) return res;
if (suffix.compare (".json") == 0) return "application/json; charset=utf-8";
if (suffix.compare (".svg") == 0) return "image/svg+xml";
if (suffix.compare (".png") == 0) return "image/png";
if (suffix.compare (".jpg") == 0) return "image/jpeg";
if (suffix.compare (".jpeg") == 0) return "image/jpeg";
if (suffix.find (".html") != std::string::npos) return res;
if (suffix.find (".htm") != std::string::npos) return res;
if (suffix.find (".js") != std::string::npos) return res;
if (suffix.find (".json") != std::string::npos) return "application/json; charset=utf-8";
if (suffix.find (".svg") != std::string::npos) return "image/svg+xml";
if (suffix.find (".png") != std::string::npos) return "image/png";
if (suffix.find (".jpg") != std::string::npos) return "image/jpeg";
if (suffix.find (".jpeg") != std::string::npos) return "image/jpeg";
return res;
};

Loading…
Cancel
Save