Tim Duesterhus | afe36e4 | 2020-11-13 19:36:47 +0100 | [diff] [blame] | 1 | varnishtest "cook sample fetch Test" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | server s1 { |
| 6 | rxreq |
| 7 | txresp |
| 8 | } -start |
| 9 | |
| 10 | haproxy h1 -conf { |
| 11 | defaults |
| 12 | mode http |
| 13 | |
| 14 | frontend fe |
| 15 | bind "fd@${fe}" |
| 16 | http-request set-var(txn.count) req.cook_cnt() |
| 17 | http-request set-var(txn.val) req.cook_val() |
| 18 | http-request set-var(txn.val_cook2) req.cook_val(cook2) |
| 19 | http-response set-header count %[var(txn.count)] |
| 20 | http-response set-header val %[var(txn.val)] |
| 21 | http-response set-header val_cook2 %[var(txn.val_cook2)] |
| 22 | |
| 23 | default_backend be |
| 24 | |
| 25 | backend be |
| 26 | server srv1 ${s1_addr}:${s1_port} |
| 27 | } -start |
| 28 | |
| 29 | client c1 -connect ${h1_fe_sock} { |
| 30 | txreq -url "/" \ |
| 31 | -hdr "cookie: cook1=0; cook2=123; cook3=22" |
| 32 | rxresp |
| 33 | expect resp.status == 200 |
| 34 | expect resp.http.count == "3" |
| 35 | expect resp.http.val == "0" |
| 36 | expect resp.http.val_cook2 == "123" |
| 37 | } -run |