libmicrohttpd

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

commit 0b7509755f4ba2b662dfdb0c883e9a17e42d0b1f
parent e04eb2189b2ed86cd774916ad983ba443876f285
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 28 Jul 2026 11:02:27 +0200

fix bogus assertion

Diffstat:
Msrc/microhttpd/connection.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -6104,8 +6104,14 @@ get_req_header (struct MHD_Connection *c, (c->rq.hdrs.hdr.name_end_found)); mhd_assert ((0 == c->rq.hdrs.hdr.value_start) || \ (c->rq.hdrs.hdr.name_len < c->rq.hdrs.hdr.value_start)); + /* A zero-length header (field) name is possible in two deliberately + non-conformant modes: a first line starting with whitespace (which is + discarded as a whole when its end is reached) and an empty field name + allowed by 'allow_empty_name'. */ mhd_assert ((0 == c->rq.hdrs.hdr.value_start) || \ - (0 != c->rq.hdrs.hdr.name_len)); + (0 != c->rq.hdrs.hdr.name_len) || \ + (c->rq.hdrs.hdr.starts_with_ws) || \ + (allow_empty_name && c->rq.hdrs.hdr.name_end_found)); mhd_assert ((0 == c->rq.hdrs.hdr.ws_start) || \ (0 == c->rq.hdrs.hdr.name_len) || \ (c->rq.hdrs.hdr.ws_start > c->rq.hdrs.hdr.name_len));