]> git.kaiwu.me - haproxy.git/commit
MINOR: hlua/filters: Add HTTPMessage.closed() to check if input is closed
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 23 Oct 2026 07:23:28 +0000 (09:23 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 23 Oct 2026 17:43:23 +0000 (19:43 +0200)
commitbd8e3642a613879519fec6ecf9c76a598ce0599a
treecce455d0b01b42f3bb8ea4cd41defb56cc46fe9d
parenta6b7aa18dff0733ed5d012eb552b0a8f7a9b7481
MINOR: hlua/filters: Add HTTPMessage.closed() to check if input is closed

There is no way for a Lua filter to know if the input of the HTTP message
it is filtering is closed, i.e. if no more data will be received on the
corresponding channel because the end of the stream was reached or an
error was detected.

HTTPMessage.eom() is not suitable to detect that. It relies on the message
framing and is only true when the end of the message was properly
reported. For instance, when a truncated request is received, no end of
message is reported but the input is nonetheless closed.

HTTPMessage.may_recv() is not suitable either because, as its name
implies, it only tells if more data may still be received at this
point. An unfinished message whose input is closed returns false.

Conversely, HTTPMessage.closed() returns true as soon as the input is
closed, whatever the message framing state. However, as for
HTTPMessage.eom(), the result is relative to the data visible by the
current filter. It is only true when all data were already exposed to
it. So if an earlier filter holds back some data, the function returns
false until these data are visible.
doc/lua-api/index.rst
src/hlua.c