BUG/MINOR: hlua: Don't consume headers when starting an HTTP lua service
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Apr 2021 08:50:21 +0000 (10:50 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Apr 2021 09:05:05 +0000 (11:05 +0200)
commitbd878d2c73b99797a4780777513fdf9eb3d1d43d
treea9ed1a44828d525f1708ba31172230e2aadfe3ed
parent1eedf9b4cb71da642399ae1efbfad2c1cdad6c33
BUG/MINOR: hlua: Don't consume headers when starting an HTTP lua service

When an HTTP lua service is started, headers are consumed before calling the
script. When it was initialized, the headers were stored in a lua array,
thus they can be removed from the HTX message because the lua service will
no longer access them. But it is a problem with bodyless messages because
the EOM flag is lost. Indeed, once the headers are consumed, the message is
empty and the buffer is reset, included the flags.

Now, the headers are not immediately consumed. We will skip them if
applet:receive() or applet:getline(). This way, the EOM flag is preserved.
At the end, when the script is finished, all output data are consumed, thus
this remains safe.

It is a 2.4-specific bug. No backport is needed.
src/hlua.c