Moemen MHEDHBI | 92f7d43 | 2021-04-01 20:53:59 +0200 | [diff] [blame] | 1 | varnishtest "ub64dec sample fetche Test" |
| 2 | |
| 3 | #REQUIRE_VERSION=2.4 |
| 4 | |
| 5 | feature ignore_unknown_macro |
| 6 | |
| 7 | haproxy h1 -conf { |
Willy Tarreau | e1465c1 | 2021-05-09 14:41:41 +0200 | [diff] [blame] | 8 | global |
| 9 | # WT: limit false-positives causing "HTTP header incomplete" due to |
| 10 | # idle server connections being randomly used and randomly expiring |
| 11 | # under us. |
| 12 | tune.idle-pool.shared off |
| 13 | |
Moemen MHEDHBI | 92f7d43 | 2021-04-01 20:53:59 +0200 | [diff] [blame] | 14 | defaults |
| 15 | mode http |
| 16 | timeout connect 1s |
| 17 | timeout client 1s |
| 18 | timeout server 1s |
| 19 | |
| 20 | frontend fe |
| 21 | bind "fd@${fe}" |
| 22 | acl input hdr(encode) -m found |
| 23 | http-request return content-type text/plain hdr encode %[hdr(encode),ub64enc] hdr decode %[hdr(decode),ub64dec] if input |
| 24 | http-request return content-type text/plain hdr encode %[bin(14fb9c03d97f12d97e),ub64enc] hdr decode %[str(FPucA9l_Etl-),ub64dec,hex,lower] if !input |
| 25 | |
| 26 | } -start |
| 27 | |
| 28 | client c1 -connect ${h1_fe_sock} { |
| 29 | txreq -hdr "encode: f" -hdr "decode: Zg" |
| 30 | rxresp |
| 31 | expect resp.http.encode == "Zg" |
| 32 | expect resp.http.decode == "f" |
| 33 | txreq -hdr "encode: fo" -hdr "decode: Zm8" |
| 34 | rxresp |
| 35 | expect resp.http.encode == "Zm8" |
| 36 | expect resp.http.decode == "fo" |
| 37 | txreq -hdr "encode: foo" -hdr "decode: Zm9v" |
| 38 | rxresp |
| 39 | expect resp.http.encode == "Zm9v" |
| 40 | expect resp.http.decode == "foo" |
| 41 | txreq -hdr "encode: foob" -hdr "decode: Zm9vYg" |
| 42 | rxresp |
| 43 | expect resp.http.encode == "Zm9vYg" |
| 44 | expect resp.http.decode == "foob" |
| 45 | txreq -hdr "encode: fooba" -hdr "decode: Zm9vYmE" |
| 46 | rxresp |
| 47 | expect resp.http.encode == "Zm9vYmE" |
| 48 | expect resp.http.decode == "fooba" |
| 49 | txreq -hdr "encode: foobar" -hdr "decode: Zm9vYmFy" |
| 50 | rxresp |
| 51 | expect resp.http.encode == "Zm9vYmFy" |
| 52 | expect resp.http.decode == "foobar" |
| 53 | txreq |
| 54 | rxresp |
| 55 | expect resp.http.encode == "FPucA9l_Etl-" |
| 56 | expect resp.http.decode == "14fb9c03d97f12d97e" |
| 57 | } -run |