blob: 1243728c0118c63f898f6f1f1d0b6480f5915241 [file] [log] [blame]
Tim Duesterhus4381d262019-10-16 15:11:15 +02001varnishtest "field converter Test"
2
3feature ignore_unknown_macro
4
5server s1 {
6 rxreq
Christopher Faulete50aabe2022-04-26 11:20:10 +02007 txresp -hdr "Connection: close"
Tim Duesterhus4381d262019-10-16 15:11:15 +02008} -repeat 3 -start
9
10haproxy h1 -conf {
11 defaults
12 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010013 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
14 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
15 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Tim Duesterhus4381d262019-10-16 15:11:15 +020016
17 frontend fe
18 bind "fd@${fe}"
19
20 #### requests
21 http-request set-var(txn.uri) path
22 http-response set-header Found %[var(txn.uri),field(3,/)] if { var(txn.uri),field(3,/) -m found }
23
24 default_backend be
25
26 backend be
27 server s1 ${s1_addr}:${s1_port}
28} -start
29
30client c1 -connect ${h1_fe_sock} {
31 txreq -url "/foo/bar/baz"
32 rxresp
33 expect resp.status == 200
34 expect resp.http.found == "bar"
35 txreq -url "/foo"
36 rxresp
37 expect resp.status == 200
38 expect resp.http.found == "<undef>"
39} -run