From: Christopher Faulet Date: Tue, 1 Dec 2026 13:48:28 +0000 (+0100) Subject: MINOR: mux-h1: ignore the trailers when formatting a non-chunked HTX message X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=2443bd1e1a80ae2b78cb25b674845d6a0a385331;p=haproxy.git MINOR: mux-h1: ignore the trailers when formatting a non-chunked HTX message h1_format_htx_msg() documents that the trailers are silently ignored when the message is not chunked, but the HTX_BLK_TLR blocks were formatted like headers in that case. A trailer name/value pair would then be emitted after the body of a non-chunked message, without any framing, corrupting the output. No caller can currently reach this (the only caller formats fixed error messages, which have no trailers), so this is a latent hardening of the documented contract. --- diff --git a/src/h1_htx.c b/src/h1_htx.c index 18501e2f5..d4d2df56a 100644 --- a/src/h1_htx.c +++ b/src/h1_htx.c @@ -1280,7 +1280,10 @@ int h1_format_htx_msg(const struct htx *htx, struct buffer *outbuf, struct h1_hd goto full; } else if (type == HTX_BLK_TLR) { - if ((flags & HTX_SL_F_CHNK) && has_eod == 0 && !b_putblk(outbuf, "0\r\n", 3)) + /* Trailers are ignored if the message is not chunked */ + if (!(flags & HTX_SL_F_CHNK)) + continue; + if (has_eod == 0 && !b_putblk(outbuf, "0\r\n", 3)) goto full; has_eod = 1; n = htx_get_blk_name(htx, blk);