blob: 32a7a70a1606fa77300e10ed0948089c30a721d4 [file] [log] [blame]
Maciej Zdebebdd4c52020-11-20 13:58:48 +00001varnishtest "del-header tests"
2
3# This config tests various http-request/response del-header operations
4# with or without specified header name matching method.
5
6feature ignore_unknown_macro
7
8server s1 {
9 rxreq
10 expect req.url == /
11 expect req.http.x-always == always
12 expect req.http.x-str1 == <undef>
13 expect req.http.x-str2 == <undef>
14 expect req.http.x-beg1 == <undef>
15 expect req.http.x-beg2 == <undef>
16 expect req.http.x-end1 == <undef>
17 expect req.http.x-end2 == end2
18 expect req.http.x-sub1 == <undef>
19 expect req.http.x-sub2 == <undef>
20 expect req.http.x-reg1 == <undef>
21 expect req.http.x-reg2 == <undef>
22 txresp -hdr "x-always: always" \
23 -hdr "x-str1: str1" \
24 -hdr "x-str2: str2" \
25 -hdr "x-beg1: beg1" \
26 -hdr "x-beg2: beg2" \
27 -hdr "x-end1: end1" \
28 -hdr "x-end2: end2" \
29 -hdr "x-sub1: sub1" \
30 -hdr "x-sub2: sub2" \
31 -hdr "x-reg1: reg1" \
32 -hdr "x-reg2: reg2"
33
34} -start
35
36haproxy h1 -conf {
37 defaults
38 mode http
39 timeout connect 1s
40 timeout client 1s
41 timeout server 1s
42
43 frontend fe
44 bind "fd@${fe}"
45
46 http-request del-header x-str1
47 http-request del-header x-str2 -m str
48 http-request del-header x-beg -m beg
49 http-request del-header end1 -m end
50 http-request del-header sub -m sub
51 http-request del-header ^x.reg.$ -m reg
52
53 http-response del-header x-str1
54 http-response del-header x-str2 -m str
55 http-response del-header x-beg -m beg
56 http-response del-header end1 -m end
57 http-response del-header sub -m sub
58 http-response del-header ^x.reg.$ -m reg
59
60 default_backend be
61
62 backend be
63 server s1 ${s1_addr}:${s1_port}
64
65} -start
66
67client c1 -connect ${h1_fe_sock} {
68 txreq -req GET -url / \
69 -hdr "x-always: always" \
70 -hdr "x-str1: str1" \
71 -hdr "x-str2: str2" \
72 -hdr "x-beg1: beg1" \
73 -hdr "x-beg2: beg2" \
74 -hdr "x-end1: end1" \
75 -hdr "x-end2: end2" \
76 -hdr "x-sub1: sub1" \
77 -hdr "x-sub2: sub2" \
78 -hdr "x-reg1: reg1" \
79 -hdr "x-reg2: reg2"
80 rxresp
81 expect resp.status == 200
82 expect resp.http.x-always == always
83 expect resp.http.x-str1 == <undef>
84 expect resp.http.x-str2 == <undef>
85 expect resp.http.x-beg1 == <undef>
86 expect resp.http.x-beg2 == <undef>
87 expect resp.http.x-end1 == <undef>
88 expect resp.http.x-end2 == end2
89 expect resp.http.x-sub1 == <undef>
90 expect resp.http.x-sub2 == <undef>
91 expect resp.http.x-reg1 == <undef>
92 expect resp.http.x-reg2 == <undef>
93} -run