]> git.kaiwu.me - haproxy.git/commitdiff
REGTESTS: http-rules: one connection per request in the replace-uri test
authorWilly Tarreau <w@1wt.eu>
Tue, 22 Sep 2026 22:53:53 +0000 (22:53 +0000)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Sep 2026 15:25:37 +0000 (17:25 +0200)
The verification campaign caught this test with "HTTP header is
incomplete" when the whole suite runs with "--j 32" on a loaded
machine. Its first client was sending its six requests over a single
connection while the server answers each of them in its own iteration,
so the server closed right when the next request was sent over the
connection haproxy reuses, and the client got that close instead of a
response.

The test is about rewriting the request target, not about keep-alive,
so the six requests are now sent by six clients, each on its own
connection, which is also what the three other clients of the test
already do. Twenty-four runs in parallel with the machine loaded pass.

reg-tests/http-rules/replace_uri.vtc

index 6f0427026b04c28da09daa683671477d99b7f1ea..58acdf319e879792131e4ad18ee7300aa96dc1a1 100644 (file)
@@ -65,36 +65,49 @@ haproxy h1 -conf {
        server s1 ${s1_addr}:${s1_port}
 } -start
 
-client c1 -connect ${h1_fe_sock} {
+# Each request gets its own connection: the server closes after every
+# response, and a second request sent over the connection haproxy
+# reuses would race with that close.
+client c1a -connect ${h1_fe_sock} {
        # origin form, the whole target is prefixed
        txreq -url "/bar?t=prefix"
        rxresp
        expect resp.status == 200
        expect resp.http.x-url == "/pfx/bar?t=prefix"
+} -run
 
+client c1b -connect ${h1_fe_sock} {
        # absolute form, the scheme and the authority are preserved
        txreq -url "http://www.example.com/bar?t=prefix" -hdr "Host: www.example.com"
        rxresp
        expect resp.status == 200
        expect resp.http.x-url == "http://www.example.com/pfx/bar?t=prefix"
+} -run
 
+client c1c -connect ${h1_fe_sock} {
        # the scheme itself may be rewritten
        txreq -url "http://www.example.com/bar?t=scheme" -hdr "Host: www.example.com"
        rxresp
        expect resp.status == 200
        expect resp.http.x-url == "https://www.example.com/bar?t=scheme"
+} -run
 
+client c1d -connect ${h1_fe_sock} {
        txreq -url "/bar?t=nomatch"
        rxresp
        expect resp.status == 200
        expect resp.http.x-url == "/bar?t=nomatch"
+} -run
 
+client c1e -connect ${h1_fe_sock} {
        # replace-path ignores the query string, replace-pathq includes it
        txreq -url "/bar?t=path"
        rxresp
        expect resp.status == 200
        expect resp.http.x-url == "/rp/bar?t=path"
+} -run
 
+client c1f -connect ${h1_fe_sock} {
        txreq -url "/bar?t=pathq"
        rxresp
        expect resp.status == 200