BUG/MEDIUM: htx: Adjust length to add DATA block in an empty HTX buffer
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 12 Jan 2022 13:03:42 +0000 (14:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 26 Jan 2022 03:34:31 +0000 (04:34 +0100)
commit23acffa0f4d4588b0d09c3e8852570bd8c20a0ea
treea6c4019b8942951bffcbd956fddbde9dc294cb15
parentb8c9a5fc68c7fa5e0047b087673b547dd16a7a14
BUG/MEDIUM: htx: Adjust length to add DATA block in an empty HTX buffer

htx_add_data() is able to partially consume data. However there is a bug
when the HTX buffer is empty.  The data length is not properly
adjusted. Thus, if it exceeds the HTX buffer size, no block is added. To fix
the issue, the length is now adjusted first.

This patch must be backported as far as 2.0.

(cherry picked from commit 28e7ba86885d60a29036bc6fa3a89777148a3762)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/htx.c