The test expects the headers and the chunk-size line to fill the buffer
on the first read, so that the request is rejected before being
forwarded. But they were sent as ~986 small writes, and when haproxy
received them in two parts (seen on FreeBSD CI), the first read did not
fill the buffer: the headers were forwarded and the server's 200 was
logged instead of the expected 400. Let's send the whole request in a
single write, with a chunk-size line longer than the buffer.
http-request return status 200
} -start
-# 42 + 984 + 2 = 1028 bytes: too long for a 1024-byte buffer
+# headers and a 1102-byte chunk-size line in a single write
+shell {
+ awk 'BEGIN { for (i = 0; i < 1100; i++) printf "0"; printf "\r\n" }' > ${tmpdir}/line
+}
+
client c1 -connect ${h1_li1_sock} {
- txreq -req POST -url /big -hdr "Transfer-Encoding: chunked" -nolen
- send_n 984 "0"
- send "\r\n"
+ txreq -req POST -url /big -hdr "Transfer-Encoding: chunked" -nolen -bodyfrom ${tmpdir}/line
} -run
# a valid request must still work