]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua/filters: Return right code when txn:done() is called
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Aug 2021 12:11:17 +0000 (14:11 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Aug 2021 15:14:47 +0000 (17:14 +0200)
txn functions can now be called from an action or a filter context. Thus the
return code must be adapted depending on this context. From an action, act.ABORT
is returned. From a filter, -1 is returned. It is the filter error code.

This bug only affects 2.5-dev. No backport needed.

src/hlua.c

index 7e68d0b33bc6b0f6f922d6dbc62289ec15ddc3e2..7eec25ce9e982b5e66650c44f2491dae9cbb1ca6 100644 (file)
@@ -7482,7 +7482,10 @@ __LJMP static int hlua_txn_done(lua_State *L)
        if (!(s->flags & SF_FINST_MASK))
                s->flags |= finst;
 
-       lua_pushinteger(L, ACT_RET_ABRT);
+       if ((htxn->flags & HLUA_TXN_CTX_MASK) == HLUA_TXN_FLT_CTX)
+               lua_pushinteger(L, -1);
+       else
+               lua_pushinteger(L, ACT_RET_ABRT);
        WILL_LJMP(hlua_done(L));
        return 0;
 }