provide a minimal 404 page

This commit is contained in:
Miguel Freitas 2015-11-09 12:05:09 -02:00
parent 1078449b80
commit b5e58adef2

View File

@ -1055,7 +1055,13 @@ void ServiceConnection(AcceptedConnection *conn)
conn->stream() << HTTPReply(HTTP_OK, str, false, contentType) << std::flush;
} else {
printf("ServiceConnection: file %s not found\n", fname.c_str());
conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush;
ostringstream s;
s << "<html><body>\r\n"
<< "<b>ERROR 404</b><br/>"
<< "ServiceConnection: file '<b>" << fname << "</b>' not found\r\n"
<< "</body></html>\r\n";
conn->stream() << HTTPReply(HTTP_NOT_FOUND, s.str(), false, "text/html; charset=utf-8") << std::flush;
}
continue;
}