]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: mux-h2: send a CANCEL instead of ES on truncated writes
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Aug 2022 14:12:15 +0000 (16:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Aug 2022 06:03:53 +0000 (08:03 +0200)
commit473e0e54f5bf48a44c202b367a6da0f0aa0b2a62
treea66b1536bbe7316a65ab30c4c3fc370b89e669dd
parent4877045f1dcbfbc3c7f49e90eb32dd03c070616d
BUG/MINOR: mux-h2: send a CANCEL instead of ES on truncated writes

If a POST upload is cancelled after having advertised a content-length,
or a response body is truncated after a content-length, we're not allowed
to send ES because in this case the total body length must exactly match
the advertised value. Till now that's what we were doing, and that was
causing the other side (possibly haproxy) to respond with an RST_STREAM
PROTOCOL_ERROR due to "ES on DATA frame before content-length".

We can behave a bit cleaner here. Let's detect that we haven't sent
everything, and send an RST_STREAM(CANCEL) instead, which is designed
exactly for this purpose.

This patch could be backported to older versions but only a little bit
of exposure to make sure it doesn't wake up a bad behavior somewhere.
It relies on the following previous commit:

   "MINOR: mux-h2: make streams know if they need to send more data"
src/mux_h2.c