http: change error for corrupted requests to 400 Bad Request

Previously it was 413 Request Entity Too Large, which was odd.
This commit is contained in:
Azat Khuzhin 2024-02-18 15:24:58 +01:00
parent f1632e5909
commit 87cdcc1868
2 changed files with 5 additions and 2 deletions

5
http.c
View File

@ -1168,8 +1168,11 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
evhttp_read_trailer(evcon, req);
return;
case DATA_CORRUPTED:
case DATA_TOO_LONG:
/* corrupted data */
evhttp_connection_fail_(evcon,
EVREQ_HTTP_INVALID_HEADER);
return;
case DATA_TOO_LONG:
evhttp_connection_fail_(evcon,
EVREQ_HTTP_DATA_TOO_LONG);
return;

View File

@ -3946,7 +3946,7 @@ http_send_chunk_malformed_test_error_cb(struct bufferevent *bev, short what, voi
TT_BLATHER(("%s: called\n", __func__));
line = evbuffer_readln(input, NULL, EVBUFFER_EOL_CRLF);
tt_str_op(line, ==, "HTTP/1.1 413 Request Entity Too Large");
tt_str_op(line, ==, "HTTP/1.1 400 Bad Request");
end:
free(line);