Hi All,
I'm upgrading some HAproxy nodes here (from 2.0.29 to 2.6.4) and everything is
going well except some Lua code I have. I've distilled the code and config to
this;
haproxy.cfg;
global
lua-load httpbug.lua
defaults
mode http
timeout client 150000
timeout connect 5000
timeout queue 5000
timeout server 360000
listen proxy
bind 127.0.0.1:10001
http-request use-service lua.httpbug
httpbug.lua:
core.register_service("httpbug", "http", function(applet)
repeat
local line = applet:getline()
core.log(core.crit, line)
until line == ''
applet:set_status(200)
applet:start_response()
applet:send("success")
end)
--
With a request like 'curl localhost: 10001 -XPOST -T body' and file called
'body' as follows;
line1
line2
line3
(where each line is newline-terminated)
With 2.0.29 I get a response (of 200 with body "success"), and line1, line2,
line3 are logged to screen (haproxy -d -f haproxy.cfg)
With 2.6.4 I see the logs of line1, line2, line3, but no response.
It appears applet:getline() blocks forever at the end of the request body,
rather than returning an empty string to indicate this like it used to (and is
documented to do).
I searched the mailing list (and SO, etc) for other examples of reading the
http request body line by line or for a report of this bug from someone else
but found nothing.
What did I do wrong?
Regards,
Robert Newson