libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 2b976faa78ef535aa9c5dbd2c830039556c5cb2b
parent d182ffc79cf301d2e7e40157f171b8c78a4addbd
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Mon, 23 Nov 2026 19:40:13 +0100

test_raw_requests.c: fixed test

Diffstat:
Msrc/microhttpd/test_raw_requests.c | 25+++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/test_raw_requests.c b/src/microhttpd/test_raw_requests.c @@ -1873,12 +1873,29 @@ run_entry (const struct corpus_entry *e, unsigned long *split_counter) } else { - /* The client side numbers are not reproducible under memory pressure; - stop as soon as the first reply is complete (or as soon as MHD closes + /* The client side numbers are not reproducible under memory pressure: + a split may leave less unprocessed data in the read buffer than the + unsplit run and thus let MHD serve more of the stream, for example + answer all pipelined requests and keep the connection alive. + Stop as soon as the first reply is complete (or as soon as MHD closes the connection if it does not reply at all) and only compare the server side observations. */ - min_resp = (0 != ref_resp) ? 1 : 0; - want_close = (0 != ref_resp) ? 0 : 1; + if ((0 == ref_resp) && + (1 == e->n_req) && + (1 == obs_get_uint (&ref, "nreq="))) + { + /* The only request has been parsed completely, but MHD has failed to + reply. The read buffer is empty when the reply is built, so the + reply stage does not depend on the split: every split must make MHD + close the connection as well. */ + min_resp = 0; + want_close = 1; + } + else + { + min_resp = 1; + want_close = 0; + } stride = 3; /* Sample: these runs are slower and less informative */ }