MINOR: reg-tests: test http-reuse with sni

Add a reg-test for connection reuse with the sni parameter. Ensure that
only connections that use the same sni are reused.
This commit is contained in:
Amaury Denoyelle 2021-01-22 16:35:22 +01:00
parent 9b626e3c19
commit e676239922
1 changed files with 45 additions and 0 deletions

View File

@ -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