blob: e5a80e342888dfc3ddd9f459be966386536f6543 [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 Faulet014b79b2022-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
13 timeout connect 1s
14 timeout client 1s
15 timeout server 1s
16
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