From: Christopher Faulet Date: Wed, 27 Sep 2023 13:05:03 +0000 (+0200) Subject: BUG/MINOR: mux-h1: Ignore C-L when sending H1 messages if T-E is also set X-Git-Tag: v2.9-dev7~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c367957851b17f1c153c4d0f75add35dea957d51;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h1: Ignore C-L when sending H1 messages if T-E is also set In fact, it is already done but both flags (H1_MF_CLEN and H1_MF_CHUNK) are set on the H1 parser. Thus it is errorprone when H1 messages are sent, especially because most of time, the "Content-length" case is processed before the "chunked" one. This may lead to compute the wrong chunk size and to miss the last chunk. This patch must be backported as far as 2.6. This case is not handled in 2.4 and lower. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index f1788de3c9..b715e76de8 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2296,6 +2296,7 @@ static size_t h1_make_eoh(struct h1s *h1s, struct h1m *h1m, struct htx *htx, siz else if ((h1m->flags & (H1_MF_XFER_ENC|H1_MF_CLEN)) == (H1_MF_XFER_ENC|H1_MF_CLEN)) { /* T-E + C-L: force close */ h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO; + h1m->flags &= ~H1_MF_CLEN; TRACE_STATE("force close mode (T-E + C-L)", H1_EV_TX_DATA|H1_EV_TX_HDRS, h1s->h1c->conn, h1s); } else if ((h1m->flags & (H1_MF_VER_11|H1_MF_XFER_ENC)) == H1_MF_XFER_ENC) {