From: Amaury Denoyelle Date: Fri, 22 Jan 2021 15:36:55 +0000 (+0100) Subject: MINOR: reg-tests: test http-reuse with proxy protocol X-Git-Tag: v2.4-dev8~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ef06c8253db12e0107c1e076ad2bc950f1e1960;p=thirdparty%2Fhaproxy.git MINOR: reg-tests: test http-reuse with proxy protocol Complete the http-reuse test with the proxy protocol usage. A server connection can be reused if the proxy protocol fields are the same. --- diff --git a/reg-tests/connection/http_reuse_conn_hash.vtc b/reg-tests/connection/http_reuse_conn_hash.vtc index e0adefc8df..e60ed05930 100644 --- a/reg-tests/connection/http_reuse_conn_hash.vtc +++ b/reg-tests/connection/http_reuse_conn_hash.vtc @@ -19,8 +19,16 @@ haproxy h1 -conf { http-request set-dst-port hdr(x-dst-port) server srv2 ${h1_feR_dst1_addr}:0 pool-low-conn 2 + # proxy protocol + # must use reuse always as consecutive requests are from different client + listen sender-proxy + bind "fd@${feS_proxy}" accept-proxy + http-reuse always + server srv2 ${h1_feR_proxy_addr}:${h1_feR_proxy_port} send-proxy + listen receiver bind "fd@${feR_ssl}" ssl crt ${testdir}/common.pem + bind "fd@${feR_proxy}" accept-proxy http-request return status 200 http-after-response set-header http_first_request %[http_first_req] @@ -99,3 +107,45 @@ client c_dst1 -connect ${h1_feS_dst_sock} { expect resp.http.x-dst == "dst2" expect resp.http.http_first_request == "0" } -run + +## first request with proxy protocol +client c_proxy -connect ${h1_feS_proxy_sock} -proxy1 "127.0.0.1:40000 ${h1_feS_proxy_addr}:${h1_feS_proxy_port}" { + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "1" + + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "0" +} -run + +## second request with same proxy protocol entry +client c_proxy -connect ${h1_feS_proxy_sock} -proxy1 "127.0.0.1:40000 ${h1_feS_proxy_addr}:${h1_feS_proxy_port}" { + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "0" +} -run + +## third request with different proxy protocol entry, no reuse +client c_proxy -connect ${h1_feS_proxy_sock} -proxy1 "127.0.0.1:50000 ${h1_feS_proxy_addr}:${h1_feS_proxy_port}" { + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "1" +} -run + +## fourth request, reuse proxy protocol +client c_proxy -connect ${h1_feS_proxy_sock} -proxy1 "127.0.0.1:50000 ${h1_feS_proxy_addr}:${h1_feS_proxy_port}" { + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "0" + + txreq + rxresp + expect resp.status == 200 + expect resp.http.http_first_request == "0" +} -run