1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-07 01:31:35 +00:00

BUG/MINOR: http-ana: Don't switch message to DATA when waiting for payload

The HTTP message must remains in BODY state during the analysis, to be able
to report accurate termination state in logs. It is also important to know
the HTTP analysis is still in progress. Thus, when we are waiting for the
message payload, the message is no longer switch to DATA state. This was
used to not process "Expect: " header at each evaluation. But thanks to the
previous patch, it is no long necessary.

This patch also fixes a bug in the lua filter api. Some functions must be
called during the message analysis and not during the payload forwarding. It
is not valid to try to manipulate headers during the forward stage because
headers are already forwarded. We rely on the message state to detect
errors. So the api was unusable if a "wait-for-body" action was used.

This patch shoud fix the issue . It relies on the commit:

  * MINOR: http-ana: Add a HTTP_MSGF flag to state the Expect header was checked

Both must be backported as far as 2.5.
This commit is contained in:
Christopher Faulet 2023-04-05 10:42:03 +02:00
parent ffcffa8e93
commit 2954bcc1e8

View File

@ -797,9 +797,8 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
* reached the buffer. It must only be called after the standard HTTP request
* processing has occurred, because it expects the request to be parsed and will
* look for the Expect header. It may send a 100-Continue interim response. It
* takes in input any state starting from HTTP_MSG_BODY and leaves with one of
* HTTP_MSG_CHK_SIZE, HTTP_MSG_DATA or HTTP_MSG_TRAILERS. It returns zero if it
* needs to read more data, or 1 once it has completed its analysis.
* returns zero if it needs to read more data, or 1 once it has completed its
* analysis.
*/
int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit)
{
@ -4056,10 +4055,8 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
}
}
msg->msg_state = HTTP_MSG_DATA;
/* Now we're in HTTP_MSG_DATA. We just need to know if all data have
* been received or if the buffer is full.
/* Now we're are waiting for the payload. We just need to know if all
* data have been received or if the buffer is full.
*/
if ((htx->flags & HTX_FL_EOM) ||
htx_get_tail_type(htx) > HTX_BLK_DATA ||