mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-25 22:20:49 +08:00
Fix issuing 411 responses as a client
15.5.12. 411 Length Required The 411 (Length Required) status code indicates that the server refuses to accept the request without a defined Content-Length (Section 8.6). The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the request content. fixes #2969
This commit is contained in:
parent
2df53c3d27
commit
5c305e7fa8
@ -2417,8 +2417,8 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {
|
||||
require_content_len = status >= 200 && status != 204 && status != 304;
|
||||
}
|
||||
if (require_content_len) {
|
||||
mg_http_reply(c, 411, "", "");
|
||||
MG_ERROR(("%s", "Content length missing from request"));
|
||||
if (!c->is_client) mg_http_reply(c, 411, "", "");
|
||||
MG_ERROR(("Content length missing from %s", is_response ? "response" : "request"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1059,8 +1059,8 @@ static void http_cb(struct mg_connection *c, int ev, void *ev_data) {
|
||||
require_content_len = status >= 200 && status != 204 && status != 304;
|
||||
}
|
||||
if (require_content_len) {
|
||||
mg_http_reply(c, 411, "", "");
|
||||
MG_ERROR(("%s", "Content length missing from request"));
|
||||
if (!c->is_client) mg_http_reply(c, 411, "", "");
|
||||
MG_ERROR(("Content length missing from %s", is_response ? "response" : "request"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user