From: Christopher Faulet Date: Mon, 2 Mar 2026 18:07:07 +0000 (+0100) Subject: BUG/MINOR: hlua: Properly enable/disable line receives from HTTP applet X-Git-Tag: v3.4-dev6~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a779d0d23ac3bd30e422d26fcae39dfff93fd524;p=thirdparty%2Fhaproxy.git BUG/MINOR: hlua: Properly enable/disable line receives from HTTP applet From a lua HTTP applet, in the getline() function, we must take care to disable receives when a line is retrieved and to restart receives when the function is called again. In addition, when an applet execution is finished, we must restart receives to properly drain the request. This patch could help to fix #3293. It must be backported to 3.3. On older version, no bug was reported so we can wait a report first. But in that case, hlua_applet_http_recv() should also be fixed (on 3.3 it was fixed during the applets refactoring). --- diff --git a/src/hlua.c b/src/hlua.c index 764c0fb84..a31ada50f 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -5833,6 +5833,9 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0)); } + /* Stop to consume until the next receive or the end of the response */ + applet_wont_consume(luactx->appctx); + /* return the result. */ luaL_pushresult(&luactx->b); return 1; @@ -5844,6 +5847,9 @@ __LJMP static int hlua_applet_http_getline(lua_State *L) { struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1)); + /* Restart to consume - could have been disabled by a previous receive */ + applet_will_consume(luactx->appctx); + /* Initialise the string catenation. */ luaL_buffinit(L, &luactx->b); @@ -11502,6 +11508,9 @@ void hlua_applet_http_fct(struct appctx *ctx) if (!(strm->flags & SF_ERR_MASK)) strm->flags |= SF_ERR_RESOURCE; http_ctx->flags |= APPLET_DONE; + + /* Restart to consume to drain the request */ + applet_will_consume(ctx); goto out; }