mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-06 15:20:56 -05:00
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).
This commit is contained in:
parent
0a02acecf3
commit
a779d0d23a
1 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue