]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: reg-tests: test http-reuse with sni
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 22 Jan 2021 15:35:22 +0000 (16:35 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 12 Feb 2021 11:48:11 +0000 (12:48 +0100)
Add a reg-test for connection reuse with the sni parameter. Ensure that
only connections that use the same sni are reused.

reg-tests/connection/http_reuse_conn_hash.vtc [new file with mode: 0644]

diff --git a/reg-tests/connection/http_reuse_conn_hash.vtc b/reg-tests/connection/http_reuse_conn_hash.vtc
new file mode 100644 (file)
index 0000000..34de202
--- /dev/null
@@ -0,0 +1,45 @@
+varnishtest "Test the http-reuse with special connection parameters"
+
+feature ignore_unknown_macro
+
+haproxy h1 -conf {
+       defaults
+               mode http
+
+       # sni
+       listen sender-sni
+               bind "fd@${feS_sni}"
+               server srv2 ${h1_feR_ssl_addr}:${h1_feR_ssl_port} ssl sni "req.hdr(x-sni)" verify none pool-low-conn 2
+
+       listen receiver
+               bind "fd@${feR_ssl}" ssl crt ${testdir}/common.pem
+               http-request return status 200
+               http-after-response set-header http_first_request %[http_first_req]
+} -start
+
+# http-reuse with sni parameters
+client c_sni -connect ${h1_feS_sni_sock} {
+       # first request
+       txreq \
+         -hdr "x-sni: custom_sni"
+       rxresp
+       expect resp.http.http_first_request == "1"
+
+       # second request with same sni, connection must be reused
+       txreq \
+         -hdr "x-sni: custom_sni"
+       rxresp
+       expect resp.http.http_first_request == "0"
+
+       # third request with a different sni, a new connection must be used
+       txreq \
+         -hdr "x-sni: custom_sni_2"
+       rxresp
+       expect resp.http.http_first_request == "1"
+
+       # fourth request, reuse sni2
+       txreq \
+         -hdr "x-sni: custom_sni_2"
+       rxresp
+       expect resp.http.http_first_request == "0"
+} -run