mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
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.
This commit is contained in:
parent
1921d20fff
commit
7ef06c8253
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user