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.
This commit is contained in:
Christopher Faulet 2023-06-12 09:16:27 +02:00
parent b7f8af3ca9
commit 28d17e26b8

View File

@ -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);