From 2a408542445f23a6afc4eb8953ab2dac1e6a2134 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 20 Nov 2020 14:22:37 +0100 Subject: [PATCH] MINOR: http-ana: Properly set message flags from the start-line flags 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/http_ana.c b/src/http_ana.c index de99a5d92..741ec56b1 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -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)