mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
httpd: 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:
parent
8d7e436a9d
commit
0f5bf0aa37
@ -871,14 +871,14 @@ get_http_headers(struct http_state *hs, const char *uri)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We are dealing with a particular filename. Look for one other
|
/* We are dealing with a particular filename. Look for one other
|
||||||
special case. We assume that any filename with "404" in it must be
|
special case. We assume that any filename with "404" in it must be
|
||||||
indicative of a 404 server error whereas all other files require
|
indicative of a 404 server error whereas all other files require
|
||||||
the 200 OK header. */
|
the 200 OK header. */
|
||||||
if (strstr(uri, "404")) {
|
if (strstr(uri, "404.") == uri) {
|
||||||
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_FOUND];
|
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_FOUND];
|
||||||
} else if (strstr(uri, "400")) {
|
} else if (strstr(uri, "400.") == uri) {
|
||||||
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_BAD_REQUEST];
|
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_BAD_REQUEST];
|
||||||
} else if (strstr(uri, "501")) {
|
} else if (strstr(uri, "501.") == uri) {
|
||||||
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_IMPL];
|
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_NOT_IMPL];
|
||||||
} else {
|
} else {
|
||||||
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_OK];
|
hs->hdrs[HDR_STRINGS_IDX_HTTP_STATUS] = g_psHTTPHeaderStrings[HTTP_HDR_OK];
|
||||||
|
Loading…
Reference in New Issue
Block a user