]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: compression: handle rewrite errors when updating response headers
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 24 Oct 2022 06:39:29 +0000 (08:39 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 24 Oct 2022 07:00:14 +0000 (09:00 +0200)
commit910b7577bce977ee08068f22df7a5d824ae4155c
treeff725100d3ce359c78bb2741c79729ebd7454091
parent176174f7e4734ca8d7a27a622be44ec386d36f4c
BUG/MEDIUM: compression: handle rewrite errors when updating response headers

When an HTTP response is compressed by HAProxy, the headers are updated.
However it is possible to encounter a rewrite error because the buffer is
full. In this case, the compression is aborted. Thus, we must be sure to
leave the response in a valid state.

For now, it is an issue because the "Content-Encoding" header is added
before all other headers manipulations. So if the compression is aborted on
error, the "Content-Encoding" header may remain while the payload is not
compressed.

So now, we take care to leave with a valid response on error by reordering
the headers manipulations. It is too painful to really rollback all changes,
especially for an edge case.

This patch should be backported as far as 2.0. Note that on the 2.0, the
legacy HTTP part is also concerned.
src/flt_http_comp.c