William Dauchy | a2a46ee | 2020-11-15 14:04:43 +0100 | [diff] [blame] | 1 | varnishtest "url_dec converter Test" |
| 2 | |
William Dauchy | a2a46ee | 2020-11-15 14:04:43 +0100 | [diff] [blame] | 3 | |
| 4 | feature ignore_unknown_macro |
| 5 | |
| 6 | server s1 { |
| 7 | rxreq |
| 8 | txresp |
| 9 | } -repeat 2 -start |
| 10 | |
| 11 | haproxy h1 -conf { |
| 12 | defaults |
| 13 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 14 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 15 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 16 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
William Dauchy | a2a46ee | 2020-11-15 14:04:43 +0100 | [diff] [blame] | 17 | |
| 18 | frontend fe |
| 19 | bind "fd@${fe}" |
| 20 | |
| 21 | http-request set-var(txn.url) url |
| 22 | http-response set-header url_dec0 "%[var(txn.url),url_dec]" |
| 23 | http-response set-header url_dec1 "%[var(txn.url),url_dec(1)]" |
| 24 | |
| 25 | default_backend be |
| 26 | |
| 27 | backend be |
| 28 | server s1 ${s1_addr}:${s1_port} |
| 29 | } -start |
| 30 | |
| 31 | client c1 -connect ${h1_fe_sock} { |
| 32 | txreq -url "/bla+%20?foo%3Dbar%2B42+42%20" |
| 33 | rxresp |
| 34 | expect resp.http.url_dec0 == "/bla+ ?foo=bar+42 42 " |
| 35 | expect resp.http.url_dec1 == "/bla ?foo=bar+42 42 " |
| 36 | expect resp.status == 200 |
| 37 | } -run |