]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: hlua: Fix Channel.line and Channel.data behavior regarding the doc
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Jan 2023 14:29:54 +0000 (15:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 11 Jan 2023 09:31:28 +0000 (10:31 +0100)
commit0ae2e63d85d1da9c20b2a8b511cd8ced8558e769
tree1550dd2c091b13812086d48849b4f39799585ef2
parent5f36bfe42e6fe1daa764c38a8ba158b710e52530
BUG/MINOR: hlua: Fix Channel.line and Channel.data behavior regarding the doc

These both functions are buggy and don't respect the documentation. They
must wait for more data, if possible.

For Channel.data(), it must happen if not enough data was received orf if no
length was specified and no data was received. The first case is properly
handled but not the second one. An empty string is return instead. In
addition, if there is no data and the channel can't receive more data, 'nil'
value must be returned.

In the same spirit, for Channel.line(), we must try to wait for more data
when no line is found if not enough data was received or if no length was
specified. Here again, only the first case is properly handled. And for this
function too, 'nil' value must be returned if there is no data and the
channel can't receive more data.

This patch is related to the issue #1993. It must be backported as far as
2.5.
src/hlua.c