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