Tim Duesterhus | 3ebaeca | 2023-11-30 16:41:17 +0100 | [diff] [blame^] | 1 | varnishtest "word converter Test" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | server s1 { |
| 6 | rxreq |
| 7 | txresp -hdr "Connection: close" |
| 8 | } -repeat 3 -start |
| 9 | |
| 10 | haproxy 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),word(2,/)] if { var(txn.uri),word(2,/) -m found } |
| 23 | |
| 24 | default_backend be |
| 25 | |
| 26 | backend be |
| 27 | server s1 ${s1_addr}:${s1_port} |
| 28 | } -start |
| 29 | |
| 30 | client 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//bar/baz" |
| 36 | rxresp |
| 37 | expect resp.status == 200 |
| 38 | expect resp.http.found == "bar" |
| 39 | txreq -url "/foo" |
| 40 | rxresp |
| 41 | expect resp.status == 200 |
| 42 | expect resp.http.found == "<undef>" |
| 43 | } -run |