blob: 74acac8ff14d8dd6fe8956ec995ff5cdbb4f9706 [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
Willy Tarreauf6739232021-11-18 17:46:22 +010015 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
16 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
17 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
William Dauchy888b0ae2021-01-06 23:39:50 +010018
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