Hi Thierry,
Le 01/03/2015 13:47, Thierry FOURNIER a écrit :
HAProxy Lua Hello world
HAProxy configuration file (hello_world.conf):
global
lua-load hello_world.lua
listen proxy
bind 127.0.0.1:10001
tcp-request content lua hello_world
HAProxy Lua file (hello_world.lua):
function hello_world(txn)
local res = txn:res_channel()
res:send("hello world\n")
end
I was wondering what would happen if a response was greater than the buffer.
It appears that sometimes it works, sometime not.
The function I used :
function hello_world(txn)
local res = txn:res_channel()
s = ""
for i = 1,32768 do
s = s .. "x"
end
res:send(s)
end
Then :
$ while true; do s=$(curl -s http://localhost:10001/|wc -c); echo $s; if
[[ $s != 32768 ]]; then break; fi; done
32768
32768
32768
32768
32768
32768
32768
32768
32768
32768
32768
32768
539952
=> Randomly, it will send extra data after the 16384 first bytes (with a
buffer of 16384 bytes), containing other parts of the memory, which may
leak other requests data.
--
Cyril Bonté