blob: d6973e3b7a737243f7834878b0a88ea6a3cef9b8 [file] [log] [blame]
Moemen MHEDHBI92f7d432021-04-01 20:53:59 +02001varnishtest "ub64dec sample fetche Test"
2
3#REQUIRE_VERSION=2.4
4
5feature ignore_unknown_macro
6
7haproxy h1 -conf {
8 defaults
9 mode http
10 timeout connect 1s
11 timeout client 1s
12 timeout server 1s
13
14 frontend fe
15 bind "fd@${fe}"
16 acl input hdr(encode) -m found
17 http-request return content-type text/plain hdr encode %[hdr(encode),ub64enc] hdr decode %[hdr(decode),ub64dec] if input
18 http-request return content-type text/plain hdr encode %[bin(14fb9c03d97f12d97e),ub64enc] hdr decode %[str(FPucA9l_Etl-),ub64dec,hex,lower] if !input
19
20} -start
21
22client c1 -connect ${h1_fe_sock} {
23 txreq -hdr "encode: f" -hdr "decode: Zg"
24 rxresp
25 expect resp.http.encode == "Zg"
26 expect resp.http.decode == "f"
27 txreq -hdr "encode: fo" -hdr "decode: Zm8"
28 rxresp
29 expect resp.http.encode == "Zm8"
30 expect resp.http.decode == "fo"
31 txreq -hdr "encode: foo" -hdr "decode: Zm9v"
32 rxresp
33 expect resp.http.encode == "Zm9v"
34 expect resp.http.decode == "foo"
35 txreq -hdr "encode: foob" -hdr "decode: Zm9vYg"
36 rxresp
37 expect resp.http.encode == "Zm9vYg"
38 expect resp.http.decode == "foob"
39 txreq -hdr "encode: fooba" -hdr "decode: Zm9vYmE"
40 rxresp
41 expect resp.http.encode == "Zm9vYmE"
42 expect resp.http.decode == "fooba"
43 txreq -hdr "encode: foobar" -hdr "decode: Zm9vYmFy"
44 rxresp
45 expect resp.http.encode == "Zm9vYmFy"
46 expect resp.http.decode == "foobar"
47 txreq
48 rxresp
49 expect resp.http.encode == "FPucA9l_Etl-"
50 expect resp.http.decode == "14fb9c03d97f12d97e"
51} -run