From: Christopher Faulet Date: Mon, 12 Jun 2023 07:16:27 +0000 (+0200) Subject: BUG/MEDIUM: hlua: Use front SC to detect EOI in HTTP applets' receive functions X-Git-Tag: v2.9-dev1~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28d17e26b846e485eac36d82da3c5439524240c7;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: hlua: Use front SC to detect EOI in HTTP applets' receive functions When an HTTP applet tries to get request data, we must take care to properly detect the end of the message. It an empty HTX message with the SC_FL_EOI flag set on the front SC. However, an issue was introduced during the SC refactoring performed in the 2.8. The backend SC is tested instead of the frontend one. Because of this bug, the receive functions hang because the test on SC_FL_EOI flag never succeeds. Of course, by checking the frontend SC (the opposite SC to the one attached to the appctx), it works. This patch should fix the issue #2180. It must be backported to the 2.8. --- diff --git a/src/hlua.c b/src/hlua.c index 742c82448b..ae0d412a4d 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -5353,7 +5353,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K /* The message was fully consumed and no more data are expected * (EOM flag set). */ - if (htx_is_empty(htx) && (sc->flags & SC_FL_EOI)) + if (htx_is_empty(htx) && (sc_opposite(sc)->flags & SC_FL_EOI)) stop = 1; htx_to_buf(htx, &req->buf); @@ -5445,7 +5445,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon /* The message was fully consumed and no more data are expected * (EOM flag set). */ - if (htx_is_empty(htx) && (sc->flags & SC_FL_EOI)) + if (htx_is_empty(htx) && (sc_opposite(sc)->flags & SC_FL_EOI)) len = 0; htx_to_buf(htx, &req->buf);