2023-10-28 18:57:07 +00:00
|
|
|
varnishtest "Check that generic TLV IDs are sent properly"
|
|
|
|
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
|
|
|
defaults
|
|
|
|
mode http
|
|
|
|
log global
|
|
|
|
|
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
|
|
|
|
listen sender
|
|
|
|
bind "fd@${feS}"
|
|
|
|
server example ${h1_feR_addr}:${h1_feR_port} send-proxy-v2 set-proxy-v2-tlv-fmt(0xE1) %[str("foo")] set-proxy-v2-tlv-fmt(0xE2)
|
|
|
|
|
|
|
|
listen receiver
|
|
|
|
bind "fd@${feR}" accept-proxy
|
|
|
|
|
|
|
|
# Check that the TLV value is set in the backend.
|
|
|
|
http-request set-var(txn.custom_tlv_a) fc_pp_tlv(0xE1)
|
|
|
|
http-after-response set-header proxy_custom_tlv_a %[var(txn.custom_tlv_a)]
|
|
|
|
|
|
|
|
# Check that TLVs without an value are sent out.
|
|
|
|
http-request set-var(txn.custom_tlv_b) fc_pp_tlv(0xE2)
|
|
|
|
http-after-response set-header proxy_custom_tlv_b %[var(txn.custom_tlv_b)]
|
|
|
|
|
|
|
|
# Note that we do not check for an invalid TLV ID as that would result in an
|
2023-11-21 18:54:16 +00:00
|
|
|
# parser error anyway.
|
2023-10-28 18:57:07 +00:00
|
|
|
|
|
|
|
http-request return status 200
|
|
|
|
} -start
|
|
|
|
|
|
|
|
|
|
|
|
client c1 -connect ${h1_feS_sock} {
|
|
|
|
txreq -url "/"
|
|
|
|
rxresp
|
|
|
|
expect resp.http.proxy_custom_tlv_a == "foo"
|
|
|
|
expect resp.http.proxy_custom_tlv_b == ""
|
|
|
|
} -run
|
|
|
|
|
|
|
|
# Ensure that we achieve the same via a default-server.
|
|
|
|
haproxy h2 -conf {
|
|
|
|
defaults
|
|
|
|
mode http
|
|
|
|
log global
|
|
|
|
|
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
|
|
|
|
listen sender
|
|
|
|
bind "fd@${feS}"
|
|
|
|
default-server send-proxy-v2 set-proxy-v2-tlv-fmt(0xE1) %[str("bar")]
|
|
|
|
server example ${h1_feR_addr}:${h1_feR_port}
|
|
|
|
|
|
|
|
listen receiver
|
|
|
|
bind "fd@${feR}" accept-proxy
|
|
|
|
|
|
|
|
http-request set-var(txn.custom_tlv_a) fc_pp_tlv(0xE1)
|
|
|
|
http-after-response set-header proxy_custom_tlv_a %[var(txn.custom_tlv_a)]
|
|
|
|
|
|
|
|
http-request return status 200
|
|
|
|
} -start
|
|
|
|
|
|
|
|
|
|
|
|
client c2 -connect ${h2_feS_sock} {
|
|
|
|
txreq -url "/"
|
|
|
|
rxresp
|
|
|
|
expect resp.http.proxy_custom_tlv_a == "bar"
|
|
|
|
} -run
|