Marcin Deranek | 40ca09c | 2021-07-13 14:05:24 +0200 | [diff] [blame] | 1 | varnishtest "be2dec converter Test" |
| 2 | |
| 3 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.5-dev0)'" |
| 4 | feature ignore_unknown_macro |
| 5 | |
| 6 | server s1 { |
| 7 | rxreq |
| 8 | txresp |
| 9 | } -repeat 3 -start |
| 10 | |
| 11 | haproxy h1 -conf { |
| 12 | defaults |
| 13 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 14 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 15 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 16 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Marcin Deranek | 40ca09c | 2021-07-13 14:05:24 +0200 | [diff] [blame] | 17 | |
| 18 | frontend fe |
| 19 | bind "fd@${fe}" |
| 20 | |
| 21 | #### requests |
| 22 | http-request set-var(txn.input) req.hdr(input) |
| 23 | |
| 24 | http-response set-header be2dec-1 "%[var(txn.input),be2dec(:,1)]" |
| 25 | http-response set-header be2dec-2 "%[var(txn.input),be2dec(-,3)]" |
| 26 | http-response set-header be2dec-3 "%[var(txn.input),be2dec(::,3,1)]" |
| 27 | |
| 28 | default_backend be |
| 29 | |
| 30 | backend be |
| 31 | server s1 ${s1_addr}:${s1_port} |
| 32 | } -start |
| 33 | |
| 34 | client c1 -connect ${h1_fe_sock} { |
| 35 | txreq -url "/" \ |
| 36 | -hdr "input:" |
| 37 | rxresp |
| 38 | expect resp.status == 200 |
| 39 | expect resp.http.be2dec-1 == "" |
| 40 | expect resp.http.be2dec-2 == "" |
| 41 | expect resp.http.be2dec-3 == "" |
| 42 | txreq -url "/" \ |
| 43 | -hdr "input: 0123456789" |
| 44 | rxresp |
| 45 | expect resp.status == 200 |
| 46 | expect resp.http.be2dec-1 == "48:49:50:51:52:53:54:55:56:57" |
| 47 | expect resp.http.be2dec-2 == "3158322-3355701-3553080-57" |
| 48 | expect resp.http.be2dec-3 == "3158322::3355701::3553080" |
| 49 | txreq -url "/" \ |
| 50 | -hdr "input: abcdefghijklmnopqrstuvwxyz" |
| 51 | rxresp |
| 52 | expect resp.status == 200 |
| 53 | expect resp.http.be2dec-1 == "97:98:99:100:101:102:103:104:105:106:107:108:109:110:111:112:113:114:115:116:117:118:119:120:121:122" |
| 54 | expect resp.http.be2dec-2 == "6382179-6579558-6776937-6974316-7171695-7369074-7566453-7763832-31098" |
| 55 | expect resp.http.be2dec-3 == "6382179::6579558::6776937::6974316::7171695::7369074::7566453::7763832" |
| 56 | } -run |