]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: httpclient/lua: error when the httpclient_start() fails
authorWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Apr 2022 09:46:13 +0000 (11:46 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 26 Apr 2022 14:15:23 +0000 (16:15 +0200)
Jump to an luaL_error() when the httpclient fails, it could be the
result of an allocation failure, or even a wrong URL.

Must be backported in 2.5.

src/hlua.c

index a2f5ca7b1bcb1195def7bfbdd95b1e33dfa2c44d..3dd2667102d09e4bcc28c31d5344fe90c20bf84e 100644 (file)
@@ -7300,7 +7300,8 @@ __LJMP static int hlua_httpclient_send(lua_State *L, enum http_meth_t meth)
                return 0;
        }
 
-       httpclient_start(hlua_hc->hc);
+       if (!httpclient_start(hlua_hc->hc))
+               WILL_LJMP(luaL_error(L, "couldn't start the httpclient"));
 
        MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_httpclient_snd_yield, TICK_ETERNITY, 0));