From: Christopher Faulet Date: Mon, 18 Feb 2019 10:35:02 +0000 (+0100) Subject: BUG/MINOR: proto-htx: Consider a XFER_LEN message as chunked by default X-Git-Tag: v2.0-dev1~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=834eee792852bce9611cfb4f921ecb805e5e516b;p=thirdparty%2Fhaproxy.git BUG/MINOR: proto-htx: Consider a XFER_LEN message as chunked by default 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. --- diff --git a/src/proto_htx.c b/src/proto_htx.c index 59b7cb2738..d1bdac2b9a 100644 --- a/src/proto_htx.c +++ b/src/proto_htx.c @@ -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; }