From c367957851b17f1c153c4d0f75add35dea957d51 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 27 Sep 2023 15:05:03 +0200 Subject: [PATCH] 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. --- src/mux_h1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mux_h1.c b/src/mux_h1.c index f1788de3c..b715e76de 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) {