From 87cdcc1868fc015665100c31cd66ca59baa15c7a Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 18 Feb 2024 15:24:58 +0100 Subject: [PATCH] http: change error for corrupted requests to 400 Bad Request Previously it was 413 Request Entity Too Large, which was odd. --- http.c | 5 ++++- test/regress_http.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 502ac303..42bddb66 100644 --- a/http.c +++ b/http.c @@ -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; diff --git a/test/regress_http.c b/test/regress_http.c index 925a3daf..72034788 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -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);