From: Christopher Faulet Date: Fri, 20 Nov 2026 16:23:57 +0000 (+0100) Subject: BUG/MINOR: lua: channel: append() must insert data at the end, not at the start X-Git-Url: https://git.kaiwu.me/http/%7B@url%7D?a=commitdiff_plain;h=a2c90b26f70fe8bc5546f89550908b1277751018;p=haproxy.git BUG/MINOR: lua: channel: append() must insert data at the end, not at the start hlua_channel_append() inserts the string at the offset of the start of the input data, like hlua_channel_prepend() does, instead of after the existing input data. The offset+len expression is computed and passed through hlua_channel_filter() but never used. The function is otherwise identical to hlua_channel_prepend(), it seems to be a copy-paste mistake when the filter-aware insert path was introduced; hlua_http_msg_append() correctly inserts at offset+len for the same operation. As a result, Channel.append() behaved exactly like Channel.prepend(), placing the string in front of the channel's input data instead of at its end, in contradiction with its documentation ("Same as Channel.insert(channel, string, channel:input())"). This patch should fix the issue #3598. It must be backported to all supported versions. --- diff --git a/src/hlua.c b/src/hlua.c index 51338956b..61545601e 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -4320,7 +4320,7 @@ __LJMP static int hlua_channel_append(lua_State *L) if (filter && !hlua_filter_from_payload(filter, chn)) WILL_LJMP(lua_error(L)); - ret = _hlua_channel_insert(chn, L, ist2(str, sz), offset); + ret = _hlua_channel_insert(chn, L, ist2(str, sz), offset+len); if (ret > 0 && filter) { struct hlua_flt_ctx *flt_ctx = filter->ctx;