blob: 1633603823545df35bfacb18fec003032cf3c18c [file] [log] [blame]
Thayne McCombs02cf4ec2022-12-14 00:19:59 -07001varnishtest "param converter Test"
2
3feature ignore_unknown_macro
4
5server s1 {
6 rxreq
7 txresp -hdr "Connection: close"
8} -repeat 10 -start
9
10haproxy h1 -conf {
11 defaults
12 mode http
13 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
14 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
15 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
16
17 frontend fe
18 bind "fd@${fe}"
19
20 ### requests
21 http-request set-var(txn.query) query
22 http-response set-header Found %[var(txn.query),param(test)] if { var(txn.query),param(test) -m found }
23
24 default_backend be
25
26 backend be
27 server s1 ${s1_addr}:${s1_port}
28} -start
29
30client c1 -connect ${h1_fe_sock} {
31 txreq -url "/foo/?test=1&b=4&d"
32 rxresp
33 expect resp.status == 200
34 expect resp.http.found == "1"
35
36 txreq -url "/?a=1&b=4&test=34"
37 rxresp
38 expect resp.status == 200
39 expect resp.http.found == "34"
40
41 txreq -url "/?test=bar"
42 rxresp
43 expect resp.status == 200
44 expect resp.http.found == "bar"
45
46 txreq -url "/?a=b&c=d"
47 rxresp
48 expect resp.status == 200
49 expect resp.http.found == "<undef>"
50
51 txreq -url "/?a=b&test=t&c=d"
52 rxresp
53 expect resp.status == 200
54 expect resp.http.found == "t"
55
56 txreq -url "/?a=b&test&c=d"
57 rxresp
58 expect resp.status == 200
59 expect resp.http.found == ""
60
61 txreq -url "/?test="
62 rxresp
63 expect resp.status == 200
64 expect resp.http.found == ""
65
66 txreq -url "/?a=b&test"
67 rxresp
68 expect resp.status == 200
69 expect resp.http.found == ""
70
71 txreq -url "/?testing=123"
72 rxresp
73 expect resp.status == 200
74 expect resp.http.found == "<undef>"
75
76 txreq -url "/?testing=123&test=4"
77 rxresp
78 expect resp.status == 200
79 expect resp.http.found == "4"
80} -run