]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Don't return the empty chunk on HEAD responses
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 1 Jul 2019 14:17:30 +0000 (16:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 1 Jul 2019 14:24:01 +0000 (16:24 +0200)
HEAD responses must not have any body payload. But, because of a bug, for chunk
reponses, the empty chunk was always added.

This patch fixes the Github issue #146. It must be backported to 2.0 and 1.9.

src/mux_h1.c

index e7d769b429190a135e484d21bc938674aebfdc3d..37cc8252dd2a6a7a7e41e96392bcaf9946617f55 100644 (file)
@@ -1682,6 +1682,8 @@ static size_t h1_process_output(struct h1c *h1c, struct buffer *buf, size_t coun
                                        h1m->flags |= (H1_MF_NO_PHDR|H1_MF_CLEAN_CONN_HDR);
                                        h1s->flags &= ~H1S_F_HAVE_O_CONN;
                                }
+                               else if ((h1m->flags & H1_MF_RESP) &&  h1s->meth == HTTP_METH_HEAD)
+                                       h1m->state = H1_MSG_DONE;
                                else
                                        h1m->state = H1_MSG_DATA;
                                break;