]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http-ana: Properly set message flags from the start-line flags
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Nov 2020 13:22:37 +0000 (14:22 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:49 +0000 (14:41 +0100)
CNT_LEN and TE_CHNK flags must be set on the message only when the
corresponding flag is set on the HTX start-line. Before, when the transfer
length was known XFER_LEN set), the HTTP_MSGF_TE_CHNK was the default. But
it is not appropriate. Now, it is only set if the message is chunked. Thus,
it is now possible to have a known transfer length without CNT_LEN or
TE_CHNK.

In addition, the BODYLESS flags may be set, independently on XFER_LEN one.

src/http_ana.c

index de99a5d92bd7206b56a43141ded69fe0b0b68f6d..741ec56b1be697f97d065d6a8e74611f57bd835c 100644 (file)
@@ -149,7 +149,10 @@ int http_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_CLEN) ? HTTP_MSGF_CNT_LEN : HTTP_MSGF_TE_CHNK);
+       if (sl->flags & HTX_SL_F_CLEN)
+               msg->flags |= HTTP_MSGF_CNT_LEN;
+       else if (sl->flags & HTX_SL_F_CHNK)
+               msg->flags |= HTTP_MSGF_TE_CHNK;
        if (sl->flags & HTX_SL_F_BODYLESS)
                msg->flags |= HTTP_MSGF_BODYLESS;
 
@@ -1537,10 +1540,13 @@ int http_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_CLEN) ? HTTP_MSGF_CNT_LEN : HTTP_MSGF_TE_CHNK);
-               if (sl->flags & HTX_SL_F_BODYLESS)
-                       msg->flags |= HTTP_MSGF_BODYLESS;
+               if (sl->flags & HTX_SL_F_CLEN)
+                       msg->flags |= HTTP_MSGF_CNT_LEN;
+               else if (sl->flags & HTX_SL_F_CHNK)
+                       msg->flags |= HTTP_MSGF_TE_CHNK;
        }
+       if (sl->flags & HTX_SL_F_BODYLESS)
+               msg->flags |= HTTP_MSGF_BODYLESS;
 
        n = txn->status / 100;
        if (n < 1 || n > 5)