libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit b0056d621f97f82682becb1a1b459818af341de6
parent 2432d969f8dc7372d2a130ef66ee0f83865394ce
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun, 23 Aug 2026 14:06:31 +0200

POST parser: fixed force closing connection after replying to chunked POST

Diffstat:
Msrc/mhd2/stream_process_request.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mhd2/stream_process_request.c b/src/mhd2/stream_process_request.c @@ -3535,6 +3535,14 @@ process_request_chunked_body (struct MHD_Connection *restrict c) || (mhd_HTTP_STAGE_BODY_RECEIVING != c->stage)); if (mhd_HTTP_STAGE_BODY_RECEIVING != c->stage) c->discard_request = true; + + /* Only the data actually taken by the parser is "processed". + Currently the parser takes all the provided data, unless it failed to + get enough large buffer memory. + TODO: in-place processing will require reworking the "recv_size" + accounting above and the buffer advancing below as well. */ + mhd_assert (size_provided <= cntn_data_ready); + c->rq.cntn.proc_size += cntn_data_ready - size_provided; } else #endif /* MHD_SUPPORT_POST_PARSER */