BUG/MEDIUM: mux-h1: Set outgoing message to DONE when payload length is reached

When a message is sent, we can switch it state to MSG_DONE if all the
announced payload was processed. This way, if the EOM flag is not set on the
message when the last expected data block is processed, the message can
still be set to MSG_DONE state.

This bug is related to the previous ones. There is a design issue with the
HTX since the 2.4. When the EOM HTX block was replaced by a flag, I tried
hard to be sure the flag is always set with the last HTX block on a
message. It works pretty well for all messages received from a client or a
server. But for internal messages, it is not so simple. Because applets
cannot always properly handle the end of messages. So, there are some cases
where the EOM flag is set on an empty message.

As a workaround, for chunked messages, we can add an EOT HTX block. It does
the trick. But for messages with a content-length, there is no empty DATA
block. Thus, the only way to be sure the end of the message was reached in
this case is to detect it in the H1 multiplexr.

We already count the amount of data processed when the payload length is
announced. Thus, we must only switch the message in DONE state when last
bytes of the payload are received. Or when the EOM flag is received of
course.

This patch must be backported as far as 2.4.

(cherry picked from commit 2eb5243e7fcd49369a0702ce49992fc534e70c53)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5244ace4c379e4f5d679af57f2f21559c9872850)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed