Web server: Send 404 as appropriate

This commit is contained in:
Henrik Rydgård committed 2023-12-29 11:21:14 +01:00
1 parent c97d5ef23f
commit 2160abb5ec
2 files changed
+8

No files matched your search

+6
View File
@@ -162,6 +162,12 @@ static Path LocalFromRemotePath(const std::string &path) {
static void DiscHandler(const http::ServerRequest &request, const Path &filename) {
s64 sz = File::GetFileSize(filename);
if (sz == 0) {
// Probably failed
request.WriteHttpResponseHeader("1.0", 404, -1, "text/plain");
request.Out()->Push("File not found.");
return;
}
std::string range;
if (request.Method() == http::RequestHeader::HEAD) {