makefsdata: error files must start with "<errnr>." to match HTTP status

This is to prevent files like "4001.jpg" getting HTTP status 400 instead
of 100.

See bug #56290.

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Simon Goldschmidt 2020-01-30 21:22:36 +01:00
parent 0f5bf0aa37
commit 75b2db4438

View File

@ -1069,17 +1069,17 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
}
fprintf(data_file, NEWLINE "/* HTTP header */");
if (strstr(filename, "404") == filename) {
if (strstr(filename, "404.") == filename) {
response_type = HTTP_HDR_NOT_FOUND;
if (useHttp11) {
response_type = HTTP_HDR_NOT_FOUND_11;
}
} else if (strstr(filename, "400") == filename) {
} else if (strstr(filename, "400.") == filename) {
response_type = HTTP_HDR_BAD_REQUEST;
if (useHttp11) {
response_type = HTTP_HDR_BAD_REQUEST_11;
}
} else if (strstr(filename, "501") == filename) {
} else if (strstr(filename, "501.") == filename) {
response_type = HTTP_HDR_NOT_IMPL;
if (useHttp11) {
response_type = HTTP_HDR_NOT_IMPL_11;