]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: mux-h1: Properly ignore trailers when a content-length is announced
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Nov 2023 07:23:45 +0000 (08:23 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Nov 2023 07:37:48 +0000 (08:37 +0100)
commitb4eaadae84462d42f0b748b882d00c0c4f8d57e8
tree4ea53a756fd7437fed6dcd59f642e2c16186dbe0
parent3dd55fa1328e84e655985c34ecae72f06cf4fd69
BUG/MEDIUM: mux-h1: Properly ignore trailers when a content-length is announced

It is not possible in H1, but in H2 (and probably H3) it is possible to have
trailers at the end of a message while a Content-Length was announced.

However, depending if the trailers are received with the last HTX DATA block
or the zero-copy forwarding is used or not, an processing error may be
triggered, leading to a 500-internal-error.

To fix the issue, when a content-length is announced and all the payload was
processed, we switch the message to H1_MSG_DONE state only if the
end-of-message was also reported (HTX_FL_EOM flag set). Otherwise, it is
switched to H1_MSG_TRAILERS state to be able to properly ignored the
trailers, if so.

The patch must be backported as far as 2.4. Be careful, this part was highly
refactored. The patch will have to be adapted to be backported.
src/mux_h1.c