blob: a3f70ade91e84bc9f5a731be3d77d79db92e053e [file] [log] [blame]
William Dauchy888b0ae2021-01-06 23:39:50 +01001varnishtest "url_enc converter test"
2
3#REQUIRE_VERSION=2.4
4
5feature ignore_unknown_macro
6
7server s1 {
8 rxreq
9 txresp
10} -repeat 2 -start
11
12haproxy 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.url0) "str(foo=bar+42 42 )"
23 http-request set-var(txn.url1) "var(txn.url0),url_enc"
24 http-request set-var(txn.url2) "var(txn.url1),url_dec"
25 http-request set-var(txn.url3) "var(txn.url2),url_enc(query)"
26 http-response set-header url_enc0 "%[var(txn.url1)]"
27 http-response set-header url_dec "%[var(txn.url2)]"
28 http-response set-header url_enc1 "%[var(txn.url3)]"
29
30 default_backend be
31
32 backend be
33 server s1 ${s1_addr}:${s1_port}
34} -start
35
36client c1 -connect ${h1_fe_sock} {
37 txreq -url "/"
38 rxresp
39 expect resp.http.url_enc0 == "foo%3Dbar%2B42%2042%20"
40 expect resp.http.url_dec == "foo=bar+42 42 "
41 expect resp.http.url_enc1 == "foo%3Dbar%2B42%2042%20"
42 expect resp.status == 200
43} -run