]> git.kaiwu.me - haproxy.git/commitdiff
REGTESTS: http-messaging: fix h1_big_chunk_size_line race on the error report
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 13:21:42 +0000 (14:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 13:24:24 +0000 (14:24 +0100)
The request is larger than the buffer, so it is always received in at
least two reads and the chunk-size line error is only detected once the
headers were consumed. Depending on whether the stream analyzed the
headers before that, the error is reported by the H1 mux ("<BADREQ>"
logged) or by the stream, after the request was forwarded to the
server (request line logged, PH-- or even PL-- with a 200). The latter
was observed on macOS.

Let's set "option http-buffer-request" to never forward the request
before the error, and accept both the "<BADREQ>" and the request line
in the log. A 400 with PR-- termination flags is now always expected.

This should be backported with the commit 6e495dbb2a48 ("BUG/MAJOR: h1-htx:
report an error on a too long chunk-size line").

reg-tests/http-messaging/h1_big_chunk_size_line.vtc

index f5173b9a3d6b9685867fbf874722cba9d7cc3ddb..7a7067af8009bcc5b32fe3df56e0f34b1236e839 100644 (file)
@@ -13,6 +13,14 @@ varnishtest "Test a chunk-size line which fills the whole buffer"
 # checked in the log because the response may be lost when the proxy
 # closes the connection with the request not fully drained.
 #
+# The request is larger than the buffer, so it is received in at least
+# two reads. Depending on the timing, the error is reported either by
+# the H1 mux, before the stream creation ("<BADREQ>" logged), or by the
+# stream, after the headers analysis (request line logged). The body is
+# waited for with "option http-buffer-request" so that the request is
+# never forwarded to the server before the error. In both cases, a 400
+# with PR-- termination flags is logged.
+#
 # The second client sends a valid request to check that the proxy
 # remains alive and behaves normally.
 
@@ -20,7 +28,7 @@ feature ignore_unknown_macro
 
 syslog S -level info {
     recv
-    expect ~ ".* li1 li1/<NOSRV> -1/-1/-1/-1/[0-9]* 400 .* PR-- .* \"<BADREQ>\""
+    expect ~ ".* li1 li1/<NOSRV> -1/-1/-1/-1/[0-9]* 400 .* PR-- .* \"(<BADREQ>|POST /big HTTP/1.1)\""
 } -start
 
 haproxy h1 -conf {
@@ -39,6 +47,7 @@ haproxy h1 -conf {
     listen li1
         bind "fd@${li1}"
         option httplog
+        option http-buffer-request
         option dontlog-normal
         log "${S_addr}:${S_port}" local0 info
         server s1 "${h1_li2_addr}:${h1_li2_port}"