From: Christopher Faulet Date: Tue, 21 Jul 2026 09:58:22 +0000 (+0200) Subject: MINOR: hlua: Use flags of HTX blocks to detect EOM from an HTTP applet X-Git-Tag: v3.5-dev8~160 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=2a93baeba368d28e62378b009296fe9136cdd213;p=haproxy.git MINOR: hlua: Use flags of HTX blocks to detect EOM from an HTTP applet When we try to get request's data from an HTTP applet, instead of testing HTX_FL_HAS_EOM flag on the message, we now rely on the flags of HTX blocks. The logic remains the same, when all DATA blocks were consumed, we consider the request as fully received. It may be when the blocks with the EOM flag was removed or because a trailer was seen. --- diff --git a/src/hlua.c b/src/hlua.c index 92663a1a4..b9c7beaaa 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -5850,6 +5850,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K case HTX_BLK_TLR: case HTX_BLK_EOT: + http_ctx->flags |= APPLET_REQ_RECV; stop = 1; break; @@ -5857,22 +5858,19 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K break; } - if (sz == vlen) + if (sz == vlen) { + if (blk->flags & HTX_BLK_FL_EOM) { + http_ctx->flags |= APPLET_REQ_RECV; + stop = 1; + } blk = htx_remove_blk(htx, blk); + } else { htx_cut_data_blk(htx, blk, vlen); break; } } - /* The message was fully consumed and no more data are expected - * (EOM flag set). - */ - if (htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM)) { - http_ctx->flags |= APPLET_REQ_RECV; - stop = 1; - } - htx_to_buf(htx, inbuf); if (!stop) { wait: @@ -5946,6 +5944,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon case HTX_BLK_TLR: case HTX_BLK_EOT: + http_ctx->flags |= APPLET_REQ_RECV; len = 0; break; @@ -5953,22 +5952,19 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon break; } - if (sz == vlen) + if (sz == vlen) { + if (blk->flags & HTX_BLK_FL_EOM) { + http_ctx->flags |= APPLET_REQ_RECV; + len = 0; + } blk = htx_remove_blk(htx, blk); + } else { htx_cut_data_blk(htx, blk, vlen); break; } } - /* The message was fully consumed and no more data are expected - * (EOM flag set). - */ - if (htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM)) { - http_ctx->flags |= APPLET_REQ_RECV; - len = 0; - } - htx_to_buf(htx, inbuf); applet_fl_clr(luactx->appctx, APPCTX_FL_INBLK_FULL);