MEDIUM: filters/lua: Be prepared to filter TCP payloads
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 9 Aug 2021 08:22:46 +0000 (10:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Aug 2021 06:57:07 +0000 (08:57 +0200)
commita1ac5fb28e89f92fc08b530c83222acc27922f1c
tree7eb0b114cd96ac4132a3912bc98fa0deb0cf539d
parent8c9e6bba0fc7feb8492cee7ebe5f925f842f004b
MEDIUM: filters/lua: Be prepared to filter TCP payloads

For filters written in lua, the tcp payloads will be filtered using methods
exposed by the Channel class. So the corrsponding C binding functions must
be prepared to process payload in a filter context and not only in an action
context.

The main change is the offset where to start to process data in the channel
buffer, and the length of these data. For an action, all input data are
considered. But for a filter, it depends on what the filter is allow to
forward when the tcp_payload callback function is called. It depends on
previous calls but also on other filters.

In addition, when the payload is modified by a lua filter, its context must
be updated. Note also that channel functions cannot yield when called from a
filter context.

For now, it is not possible to define callbacks to filter data and the
documentation has not been updated.
src/hlua.c