From: Christopher Faulet Date: Thu, 3 Dec 2026 13:21:42 +0000 (+0100) Subject: REGTESTS: http-messaging: fix h1_big_chunk_size_line race on the error report X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=b026ab84f23824e6d4e587d920d69fc862d6279f;p=haproxy.git REGTESTS: http-messaging: fix h1_big_chunk_size_line race on the error report 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 ("" 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 "" 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"). --- diff --git a/reg-tests/http-messaging/h1_big_chunk_size_line.vtc b/reg-tests/http-messaging/h1_big_chunk_size_line.vtc index f5173b9a3..7a7067af8 100644 --- a/reg-tests/http-messaging/h1_big_chunk_size_line.vtc +++ b/reg-tests/http-messaging/h1_big_chunk_size_line.vtc @@ -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 ("" 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/ -1/-1/-1/-1/[0-9]* 400 .* PR-- .* \"\"" + expect ~ ".* li1 li1/ -1/-1/-1/-1/[0-9]* 400 .* PR-- .* \"(|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}"