blob: ffd58ee4823ea50e69e970d08f756db54cee93ae [file] [log] [blame]
Tim Duesterhus3943e4f2020-09-11 14:25:23 +02001varnishtest "iif converter Test"
Willy Tarreau0f08c372020-09-29 10:51:16 +02002#REQUIRE_VERSION=2.3
Tim Duesterhus3943e4f2020-09-11 14:25:23 +02003
4feature ignore_unknown_macro
5
6server s1 {
7 rxreq
8 txresp
9} -repeat 3 -start
10
11haproxy h1 -conf {
12 defaults
13 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010014 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
15 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
16 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Tim Duesterhus3943e4f2020-09-11 14:25:23 +020017
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
31client 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