blob: 6e3df8819927ace8cda40022d96502b1f8a692cf [file] [log] [blame]
Christopher Faulet4f337602020-11-17 10:47:35 +01001varnishtest "Filtering test with several filters and random forwarding (via trace filter)"
2
3#REQUIRE_VERSION=2.4
4#REQUIRE_OPTION=ZLIB|SLZ
5#REGTEST_TYPE=slow
6
7feature ignore_unknown_macro
8
9barrier b1 cond 2 -cyclic
10
11server s1 {
12 rxreq
13 expect req.url == "/"
14 expect req.bodylen == 1048576
15 expect req.http.accept-encoding == "<undef>"
16 txresp \
17 -hdr "Content-Type: text/plain" \
18 -bodylen 1048576
19
20 rxreq
Christopher Faulet215e0d72022-07-07 09:52:54 +020021 expect req.url == "127.0.0.1:80"
Christopher Faulet4f337602020-11-17 10:47:35 +010022 txresp \
23 -hdr "Content-Length: 0"
24 recv 36000
25 send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz"
26 barrier b1 sync
Christopher Faulet6071c2d2021-01-25 12:02:00 +010027
28 accept
29 rxreq
30 expect req.url == "/"
31 txresp -nolen \
32 -hdr "Content-Type: text/plain" \
33 -bodylen 20480
34 close
35
36 accept
37 rxreq
38 expect req.url == "/"
39 txresp -nolen
Christopher Faulet4a9db772021-10-04 07:50:13 +020040 close
41
42 accept
43 rxreq
44 expect req.url == "/"
45 expect req.bodylen == 20480
46 txresp -nolen \
47 -hdr "Content-Type: text/plain" \
48 -bodylen 20480
49
Christopher Faulet4f337602020-11-17 10:47:35 +010050} -start
51
52haproxy h1 -conf {
53 defaults
54 mode http
55 ${no-htx} option http-use-htx
56 timeout connect 1s
57 timeout client 1s
58 timeout server 1s
59
60 frontend fe1
61 bind "fd@${fe1}"
62
63 compression offload
64 compression algo gzip
65
66 filter trace name "BEFORE" random-forwarding quiet
67 filter compression
68 filter trace name "AFTER" random-forwarding quiet
69 default_backend be1
70
71 backend be1
72 server www ${s1_addr}:${s1_port}
73
Christopher Faulet4a9db772021-10-04 07:50:13 +020074 listen li1
75 mode tcp
76 bind "fd@${li1}"
77 # Validate nothing is blocked in TCP mode
78 filter compression
79 server www ${s1_addr}:${s1_port}
80
81
Christopher Faulet4f337602020-11-17 10:47:35 +010082} -start
83
84client c1 -connect ${h1_fe1_sock} {
85 txreq -url "/" \
86 -hdr "Accept-Encoding: gzip" \
87 -hdr "Content-Type: text/plain" \
88 -bodylen 1048576
89 rxresp
90 expect resp.status == 200
91 expect resp.http.content-encoding == "gzip"
92 expect resp.http.transfer-encoding == "chunked"
93 gunzip
94 expect resp.bodylen == 1048576
95
Christopher Faulet215e0d72022-07-07 09:52:54 +020096 txreq -method "CONNECT" -url "127.0.0.1:80" -hdr "host: 127.0.0.1:80" -nolen
Christopher Faulet4f337602020-11-17 10:47:35 +010097 rxresp
98 expect resp.status == 200
99 send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz"
100 recv 36000
101 barrier b1 sync
102} -run
Christopher Faulet6071c2d2021-01-25 12:02:00 +0100103
104client c2 -connect ${h1_fe1_sock} {
105 txreq -url "/" \
106 -hdr "Accept-Encoding: gzip" \
107 -hdr "Content-Type: text/plain"
108 rxresp
109 expect resp.status == 200
110 expect resp.http.content-encoding == "<undef>"
111 expect resp.http.transfer-encoding == "<undef>"
112 expect resp.http.content-length == "<undef>"
113 expect resp.bodylen == 20480
114} -run
115
116client c3 -connect ${h1_fe1_sock} {
117 txreq -url "/" \
118 -hdr "Accept-Encoding: gzip" \
119 -hdr "Content-Type: text/plain"
120 rxresp
121 expect resp.status == 200
122 expect resp.http.content-encoding == "<undef>"
123 expect resp.http.transfer-encoding == "<undef>"
124 expect resp.http.content-length == "<undef>"
125 expect resp.bodylen == 0
126} -run
Christopher Faulet4a9db772021-10-04 07:50:13 +0200127
128client c4 -connect ${h1_li1_sock} {
129 txreq -url "/" \
130 -hdr "Accept-Encoding: gzip" \
131 -hdr "Content-Type: text/plain" \
132 -bodylen 20480
133 rxresp
134 expect resp.status == 200
135 expect resp.http.content-encoding == "<undef>"
136 expect resp.http.transfer-encoding == "<undef>"
137 expect resp.http.content-length == "<undef>"
138 expect resp.bodylen == 20480
139 expect_close
140} -run