]> git.kaiwu.me - haproxy.git/commitdiff
REGTESTS: http-messaging: send h1_big_chunk_size_line request at once
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 18 Nov 2026 12:44:29 +0000 (13:44 +0100)
committerOlivier Houchard <cognet@ci0.org>
Wed, 18 Nov 2026 12:35:17 +0000 (13:35 +0100)
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.

reg-tests/http-messaging/h1_big_chunk_size_line.vtc

index 24b4da51328d2d05f7b4aec0f679256e634f2bd6..f5173b9a3d6b9685867fbf874722cba9d7cc3ddb 100644 (file)
@@ -48,11 +48,13 @@ haproxy h1 -conf {
         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