]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: hlua: Fix Channel:data() and Channel:line() to respect documentation
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 May 2025 14:12:13 +0000 (16:12 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 13 May 2025 17:51:40 +0000 (19:51 +0200)
commita5de0e15959a241afc9afb39f1b02a2517894f7b
tree3db3c872f303dd42df19699f39fa9dfdd488a7af
parente049bd00ab9b8c65149413d40ef000555f75ba47
BUG/MINOR: hlua: Fix Channel:data() and Channel:line() to respect documentation

When the channel API was revisted, the both functions above was added. An
offset can be passed as argument. However, this parameter could be reported
to be out of range if there was not enough input data was received yet. It
is an issue, especially with a tcp rule, because more data could be
received. If an error is reported too early, this prevent the rule to be
reevaluated later. In fact, an error should only be reported if the offset
is part of the output data.

Another issue is about the conditions to report 'nil' instead of an empty
string. 'nil' was reported when no data was found. But it is not aligned
with the documentation. 'nil' must only be returned if no more data cannot
be received and there is no input data at all.

This patch should fix the issue #2716. It should be backported as far as 2.6.
src/hlua.c