]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: stats: Fix how huge POST data are read from the channel
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Feb 2019 14:30:57 +0000 (15:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Mar 2019 14:50:23 +0000 (15:50 +0100)
commit2f9a41d52b28b88d44aab063bb2b88025a388981
tree2093820b5cbeb6b3917a3ceb1fe64eb340bd0dd6
parentfe261551b9980fe33990eb34d2153bf1de24b20f
BUG/MAJOR: stats: Fix how huge POST data are read from the channel

When the body length is greater than a chunk size (so if length of POST data
exceeds the buffer size), the requests is rejected with the status code
STAT_STATUS_EXCD. Otherwise the stats applet will wait to have all the data to
copy and parse them. But there is a problem when the total request size
(including the headers) is just lower than the buffer size but greater the
buffer size less the reserve. In such case, the body length is considered as
enough small to be processed but not entierly received. So the stats applet
waits for more data. But because outgoing data are still there, the channel's
buffer is considered as full and nothing more can be read, leading to a freeze
of the session.

Note this bug is pretty easy to reproduce with the legacy HTTP. It is harder
with the HTX but still possible. To fix the bug, in the stats applet, when the
request is not fully received, we check if at least the reserve remains
available the channel's buffer.

This patch must be backported as far as 1.5. But because the HTX does not exist
in 1.8 and lower, it will have to be adapted for these versions.
src/stats.c