summaryrefslogtreecommitdiffstats
path: root/reg-tests/filters/random-forwarding.vtc
blob: abb2bccfa41475c10bdb92f05e735a168d066e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
varnishtest "Filtering test with several filters and random forwarding (via trace filter)"

#REQUIRE_VERSION=2.4
#REQUIRE_OPTION=ZLIB|SLZ
#REGTEST_TYPE=slow

feature ignore_unknown_macro

barrier b1 cond 2 -cyclic

server s1 {
        rxreq
        expect req.url == "/"
        expect req.bodylen == 1048576
        expect req.http.accept-encoding == "<undef>"
        txresp \
          -hdr "Content-Type: text/plain" \
          -bodylen 1048576

        rxreq
        expect req.url == "127.0.0.1:80"
        txresp -nolen
        recv 36000
        send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz"
        barrier b1 sync

        accept
        rxreq
        expect req.url == "/"
        txresp -nolen \
          -hdr "Content-Type: text/plain" \
          -bodylen 20480
        close

        accept
        rxreq
        expect req.url == "/"
        txresp -nolen
        close

        accept
        rxreq
        expect req.url == "/"
        expect req.bodylen == 20480
        txresp -nolen \
          -hdr "Content-Type: text/plain" \
          -bodylen 20480

} -start

haproxy h1 -conf {
    defaults
        mode http
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    frontend fe1
        bind "fd@${fe1}"

        compression offload
        compression algo gzip

        filter trace name "BEFORE" random-forwarding quiet
        filter compression
        filter trace name "AFTER" random-forwarding quiet
        default_backend be1

    backend be1
        server www ${s1_addr}:${s1_port}

    listen li1
        mode tcp
        bind "fd@${li1}"
        # Validate nothing is blocked in TCP mode
        filter compression
        server www ${s1_addr}:${s1_port}


} -start

client c1 -connect ${h1_fe1_sock} {
        txreq -url "/" \
          -hdr "Accept-Encoding: gzip" \
          -hdr "Content-Type: text/plain" \
          -bodylen 1048576
        rxresp
        expect resp.status == 200
        expect resp.http.content-encoding == "gzip"
        expect resp.http.transfer-encoding == "chunked"
	gunzip
        expect resp.bodylen == 1048576

        txreq -method "CONNECT" -url "127.0.0.1:80" -nolen
        rxresp -no_obj
        expect resp.status == 200
        send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz"
        recv 36000
        barrier b1 sync
} -run

client c2 -connect ${h1_fe1_sock} {
        txreq -url "/" \
          -hdr "Accept-Encoding: gzip" \
          -hdr "Content-Type: text/plain"
        rxresp
        expect resp.status == 200
        expect resp.http.content-encoding == "<undef>"
        expect resp.http.transfer-encoding == "<undef>"
        expect resp.http.content-length == "<undef>"
        expect resp.bodylen == 20480
} -run

client c3 -connect ${h1_fe1_sock} {
        txreq -url "/" \
          -hdr "Accept-Encoding: gzip" \
          -hdr "Content-Type: text/plain"
        rxresp
        expect resp.status == 200
        expect resp.http.content-encoding == "<undef>"
        expect resp.http.transfer-encoding == "<undef>"
        expect resp.http.content-length == "<undef>"
        expect resp.bodylen == 0
} -run

client c4 -connect ${h1_li1_sock} {
        txreq -url "/" \
          -hdr "Accept-Encoding: gzip" \
          -hdr "Content-Type: text/plain" \
          -bodylen 20480
        rxresp
        expect resp.status == 200
        expect resp.http.content-encoding == "<undef>"
        expect resp.http.transfer-encoding == "<undef>"
        expect resp.http.content-length == "<undef>"
        expect resp.bodylen == 20480
        expect_close
} -run