]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: proto-htx: Consider a XFER_LEN message as chunked by default
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Feb 2019 10:35:02 +0000 (11:35 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 18 Feb 2019 15:25:06 +0000 (16:25 +0100)
An HTX message with a known body length is now considered by default as
chunked. It means the header "content-length" must be found to consider it as a
non-chunked message. Before, it was the reverse, the message was considered with
a content length by default. But it is a bug for HTTP/2 messages. There is no
chunked transfer encoding in HTTP/2 but internally messages without content
length are considered as chunked. It eases HTTP/1 <-> HTTP/2 conversions.

This patch must be backported to 1.9.

src/proto_htx.c

index 59b7cb2738355f486cfeda3f8d438eb98355610b..d1bdac2b9a698839e6c510982c5da7c3e329f871 100644 (file)
@@ -312,7 +312,7 @@ int htx_wait_for_request(struct stream *s, struct channel *req, int an_bit)
        if (sl->flags & HTX_SL_F_VER_11)
                 msg->flags |= HTTP_MSGF_VER_11;
        msg->flags |= HTTP_MSGF_XFER_LEN;
-       msg->flags |= ((sl->flags & HTX_SL_F_CHNK) ? HTTP_MSGF_TE_CHNK : HTTP_MSGF_CNT_LEN);
+       msg->flags |= ((sl->flags & HTX_SL_F_CLEN) ? HTTP_MSGF_CNT_LEN : HTTP_MSGF_TE_CHNK);
        if (sl->flags & HTX_SL_F_BODYLESS)
                msg->flags |= HTTP_MSGF_BODYLESS;
 
@@ -1625,7 +1625,7 @@ int htx_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                 msg->flags |= HTTP_MSGF_VER_11;
        if (sl->flags & HTX_SL_F_XFER_LEN) {
                msg->flags |= HTTP_MSGF_XFER_LEN;
-               msg->flags |= ((sl->flags & HTX_SL_F_CHNK) ? HTTP_MSGF_TE_CHNK : HTTP_MSGF_CNT_LEN);
+               msg->flags |= ((sl->flags & HTX_SL_F_CLEN) ? HTTP_MSGF_CNT_LEN : HTTP_MSGF_TE_CHNK);
                if (sl->flags & HTX_SL_F_BODYLESS)
                        msg->flags |= HTTP_MSGF_BODYLESS;
        }