]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: hlua: wait for the request in HTTP applets
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 19 Nov 2026 13:51:19 +0000 (14:51 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 19 Nov 2026 15:58:22 +0000 (16:58 +0100)
Since the HTTP applet uses its own buffers, it only waits for the input
buffer to be allocated before parsing the request, so it may run on an
empty buffer and crash on BUG_ON() when it is woken up before the request
was transferred, e.g. when the stream yields after the applet creation.

Let's wait for some input data instead, as the other HTTP applets do.

This was introduced by commit 48df877da ("MEDIUM: hlua: Update the http
applet to use its own buffers") in 3.3-dev4, so it must be backported to
3.3.

src/hlua.c

index 9ff1cbf57364cedbac3c0f2df9db16fdca8e8807..1f227d3543a24d69602c107b4d348914081e5508 100644 (file)
@@ -11058,7 +11058,7 @@ void hlua_applet_http_fct(struct appctx *ctx)
                int app_idx = 1 - hlua->nargs; /* index of the HTTP applet object in the lua stask */
 
                inbuf = applet_get_inbuf(ctx);
-               if (!inbuf) {
+               if (!inbuf || !applet_htx_input_data(ctx)) {
                        applet_need_more_data(ctx);
                        yield = 1;
                        goto out;