From: Christopher Faulet Date: Wed, 22 Apr 2026 14:40:55 +0000 (+0200) Subject: BUG/MINOR: mux-h1: Fix condition to send null-chunk for bodyless message X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=392abee6d4fc6e86488829ea40ad8dbbbb35ba71;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h1: Fix condition to send null-chunk for bodyless message When the EOH block is processed, before sending message headers, there is a test to know if there is no payload. In case of a chunked message, a null-chunk is emitted, except for bodyless response. For instance, a response to a HEAD request has no payload at all and no null-chunk. However, the test for bodyless responses is not correct. Only H1S_F_BODYLESS_RESP flag is tested. But this flag can be set on server side when we are processing the request. To fix the issue, the test was adapted. The null-chunk is added if a message with no payload is chunked and it is a request or a non-bodyless responses. This patch must be backported to all stable version. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index eaf9f43c8..b05ddcc9a 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2988,7 +2988,8 @@ static size_t h1_make_eoh(struct h1s *h1s, struct h1m *h1m, struct htx *htx, siz * payload. If cannot be removed now. We must emit the end of * the message first to be sure the output buffer is not full */ - if ((h1m->flags & H1_MF_CHNK) && !(h1s->flags & H1S_F_BODYLESS_RESP)) { + if ((h1m->flags & H1_MF_CHNK) && (!(h1m->flags & H1_MF_RESP) || !(h1s->flags & H1S_F_BODYLESS_RESP))) { + /* Send null-chunk except for bodyless reasponses */ if (!chunk_memcat(&outbuf, "\r\n0\r\n\r\n", 7)) goto full; }