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.
This commit is contained in:
Christopher Faulet 2020-11-20 14:22:37 +01:00
parent 6ade861305
commit 2a40854244

View 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)