]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Do not send a last null chunk on body-less answers
authorMickael Torres <ghub@mtorres.fr>
Wed, 16 Nov 2022 13:29:37 +0000 (14:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 16 Nov 2022 15:25:26 +0000 (16:25 +0100)
HEAD answers should not contain any body data. Currently when a
"transfer-encoding: chunked" header is returned, a last null-chunk is added to
the answer. Some clients choke on it and fail when trying to reuse the
connection. Check that the response should not be body-less before sending the
null-chunk.

This patch should fix #1932. It must be backported as far as 2.4.

src/mux_h1.c

index 5511e1b4cef188e32204ee57d2984857845c4f27..eee97115c440a75a1cdd41e0b7181d43e38b8dbe 100644 (file)
@@ -2292,7 +2292,7 @@ static size_t h1_process_mux(struct h1c *h1c, struct buffer *buf, size_t count)
                                        /* EOM flag is set or empty payload (C-L to 0) and it is the last block */
                                        if (htx_is_unique_blk(chn_htx, blk) &&
                                            ((chn_htx->flags & HTX_FL_EOM) || ((h1m->flags & H1_MF_CLEN) && !h1m->curr_len))) {
-                                               if (h1m->flags & H1_MF_CHNK) {
+                                               if ((h1m->flags & H1_MF_CHNK) && !(h1s->flags & H1S_F_BODYLESS_RESP)) {
                                                        if (!chunk_memcat(&tmp, "\r\n0\r\n\r\n", 7))
                                                                goto full;
                                                }