blob: 2982c880f3b46898b16c43b4ce824c6cca6edd6c [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
21 expect req.url == "/"
22 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 Faulet4f337602020-11-17 10:47:35 +010040} -start
41
42haproxy h1 -conf {
43 defaults
44 mode http
45 ${no-htx} option http-use-htx
46 timeout connect 1s
47 timeout client 1s
48 timeout server 1s
49
50 frontend fe1
51 bind "fd@${fe1}"
52
53 compression offload
54 compression algo gzip
55
56 filter trace name "BEFORE" random-forwarding quiet
57 filter compression
58 filter trace name "AFTER" random-forwarding quiet
59 default_backend be1
60
61 backend be1
62 server www ${s1_addr}:${s1_port}
63
64} -start
65
66client c1 -connect ${h1_fe1_sock} {
67 txreq -url "/" \
68 -hdr "Accept-Encoding: gzip" \
69 -hdr "Content-Type: text/plain" \
70 -bodylen 1048576
71 rxresp
72 expect resp.status == 200
73 expect resp.http.content-encoding == "gzip"
74 expect resp.http.transfer-encoding == "chunked"
75 gunzip
76 expect resp.bodylen == 1048576
77
78 txreq -method "CONNECT" -url "/" -nolen
79 rxresp
80 expect resp.status == 200
81 send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz"
82 recv 36000
83 barrier b1 sync
84} -run
Christopher Faulet6071c2d2021-01-25 12:02:00 +010085
86client c2 -connect ${h1_fe1_sock} {
87 txreq -url "/" \
88 -hdr "Accept-Encoding: gzip" \
89 -hdr "Content-Type: text/plain"
90 rxresp
91 expect resp.status == 200
92 expect resp.http.content-encoding == "<undef>"
93 expect resp.http.transfer-encoding == "<undef>"
94 expect resp.http.content-length == "<undef>"
95 expect resp.bodylen == 20480
96} -run
97
98client c3 -connect ${h1_fe1_sock} {
99 txreq -url "/" \
100 -hdr "Accept-Encoding: gzip" \
101 -hdr "Content-Type: text/plain"
102 rxresp
103 expect resp.status == 200
104 expect resp.http.content-encoding == "<undef>"
105 expect resp.http.transfer-encoding == "<undef>"
106 expect resp.http.content-length == "<undef>"
107 expect resp.bodylen == 0
108} -run