]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: httpclient: Throw an error if an lua httpclient instance is reused
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 May 2025 16:35:30 +0000 (18:35 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 May 2025 16:47:24 +0000 (18:47 +0200)
commit50fca6f0b7ebee94b5ebe402e37af9d7d945fe64
treeed6618dbefb079c68652e0596ce707e7254fc34c
parent94ded5523fab947bf76fe0960611d3232bb5c4fa
BUG/MEDIUM: httpclient: Throw an error if an lua httpclient instance is reused

It is not expected/supported to reuse an httpclient instance to process
several requests. A new instance must be created for each request. However,
in lua, there is nothing to prevent a user to create an httpclient object
and use it in a loop to process requests.

That's unfortunate because this will apparently work, the requests will be
sent and a response will be received and processed. However internally some
ressources will be allocated and never released. When the next response is
processed, the ressources allocated for the previous one are definitively
lost.

In this patch we take care to check that the httpclient object was never
used when a request is sent from a lua script by checking
HTTPCLIENT_FS_STARTED flags. This flag is set when a httpclient applet is
spawned to process a request and never removed after that. In lua, the
httpclient applet is created when the request is sent. So, it is the right
place to do this test.

This patch should fix the issue #2986. It should be backported as far as
2.6.
src/hlua.c