Tim Duesterhus | 3943e4f | 2020-09-11 14:25:23 +0200 | [diff] [blame] | 1 | varnishtest "iif converter Test" |
Willy Tarreau | 0f08c37 | 2020-09-29 10:51:16 +0200 | [diff] [blame] | 2 | #REQUIRE_VERSION=2.3 |
Tim Duesterhus | 3943e4f | 2020-09-11 14:25:23 +0200 | [diff] [blame] | 3 | |
| 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 |
| 14 | timeout connect 1s |
| 15 | timeout client 1s |
| 16 | timeout server 1s |
| 17 | |
| 18 | frontend fe |
| 19 | bind "fd@${fe}" |
| 20 | |
| 21 | #### requests |
| 22 | http-request set-var(txn.iif) req.hdr_cnt(count),iif(ok,ko) |
| 23 | http-response set-header iif %[var(txn.iif)] |
| 24 | |
| 25 | default_backend be |
| 26 | |
| 27 | backend be |
| 28 | server s1 ${s1_addr}:${s1_port} |
| 29 | } -start |
| 30 | |
| 31 | client c1 -connect ${h1_fe_sock} { |
| 32 | txreq |
| 33 | rxresp |
| 34 | expect resp.status == 200 |
| 35 | expect resp.http.iif == "ko" |
| 36 | txreq \ |
| 37 | -hdr "count: 1" |
| 38 | rxresp |
| 39 | expect resp.status == 200 |
| 40 | expect resp.http.iif == "ok" |
| 41 | txreq \ |
| 42 | -hdr "count: 1,2" |
| 43 | rxresp |
| 44 | expect resp.status == 200 |
| 45 | expect resp.http.iif == "ok" |
| 46 | } -run |