commit 68c83f22b84ab115117f724dbe7fc846549207c5 parent 300a2ab01c84de26d00c4989004de7c7b5549025 Author: Christian Grothoff <christian@grothoff.org> Date: Tue, 28 Jul 2026 11:00:28 +0200 fix bogus assertion Diffstat:
| M | src/microhttpd/connection.c | | | 9 | ++++++++- |
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -3579,8 +3579,15 @@ handle_recv_no_space (struct MHD_Connection *c, return; case MHD_PROC_RECV_BODY_NORMAL: case MHD_PROC_RECV_BODY_CHUNKED: + /* The 'some_payload_processed' flag reflects the *last* application + callback only. After that callback more data may have been received + from the network, in particular a chunk-size line with a chunk + extension that does not fit into the read buffer. Therefore the flag + alone does not imply that free space is available; it does so only as + long as unprocessed payload is still sitting in the buffer. */ mhd_assert ((MHD_PROC_RECV_BODY_CHUNKED != stage) || \ - ! c->rq.some_payload_processed); + (! c->rq.some_payload_processed) || \ + (! has_unprocessed_upload_body_data_in_buffer (c))); if (has_unprocessed_upload_body_data_in_buffer (c)) { /* The connection must not be in MHD_EVENT_LOOP_INFO_READ state