serve SHTML files with HTML MIME type

This commit is contained in:
Stephen Birarda 2015-12-17 10:48:33 -08:00
parent 40272faa3f
commit 286b984d6f

View file

@ -145,9 +145,14 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url,
localFileData = localFileString.toLocal8Bit();
}
connection->respond(HTTPConnection::StatusCode200, localFileData,
qPrintable(mimeDatabase.mimeTypeForFile(filePath).name()));
// if this is an shtml file just make the MIME type match HTML so browsers aren't confused
auto mimeType = QString { "text/html" };
if (localFileInfo.suffix() != "shtml") {
mimeType = mimeDatabase.mimeTypeForFile(filePath).name();
}
connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeType));
return true;
}