]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient: end callback in applet release
authorWilliam Lallemand <wlallemand@haproxy.org>
Wed, 6 Apr 2022 12:12:37 +0000 (14:12 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 6 Apr 2022 12:19:36 +0000 (14:19 +0200)
In case an error provokes the release of the applet, we will never call
the end callback of the httpclient.

In the case of a lua script, it would mean that the lua task will never
be waked up after a yield, letting the lua script stuck forever.

Fix the issue by moving the callback from the end of the iohandler to
the applet release function.

Must be backported in 2.5.

src/http_client.c

index f06be65941d030eb21403a4315507310ce74ae90..e8d7b05c5419c47b0c5d48302b21b1f50f786910 100644 (file)
@@ -946,8 +946,6 @@ more:
        return;
 
 end:
-       if (hc->ops.res_end)
-               hc->ops.res_end(hc);
        si_shutw(si);
        si_shutr(si);
        return;
@@ -963,6 +961,8 @@ static void httpclient_applet_release(struct appctx *appctx)
         * again from the caller */
        hc->appctx = NULL;
 
+       if (hc->ops.res_end)
+               hc->ops.res_end(hc);
 
        /* destroy the httpclient when set to autotokill */
        if (hc->flags & HTTPCLIENT_FA_AUTOKILL) {