blob: 6e8c1e879609fbdbbab45cc2b5b709da2201385a [file] [log] [blame]
PiBa-NL4dc3f3b2018-12-23 21:21:51 +01001# Checks that compression doesnt cause corruption..
2
3varnishtest "Compression validation"
4#REQUIRE_VERSION=1.6
5#REQUIRE_OPTIONS=ZLIB|SLZ,LUA
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01006#REGTEST_TYPE=slow
PiBa-NL4dc3f3b2018-12-23 21:21:51 +01007
8feature ignore_unknown_macro
9
10haproxy h1 -conf {
11global
12# log stdout format short daemon
Frédéric Lécailleb894f922019-03-29 16:13:48 +010013 lua-load ${testdir}/lua_validation.lua
PiBa-NL4dc3f3b2018-12-23 21:21:51 +010014
15defaults
16 mode http
17 log global
18 ${no-htx} option http-use-htx
19 option httplog
20
21frontend main-https
22 bind "fd@${fe1}" ssl crt ${testdir}/common.pem
23 compression algo gzip
24 compression type text/html text/plain application/json application/javascript
25 compression offload
26 use_backend TestBack if TRUE
27
28backend TestBack
29 server LocalSrv ${h1_fe2_addr}:${h1_fe2_port}
30
31listen fileloader
32 mode http
33 bind "fd@${fe2}"
34 http-request use-service lua.fileloader-http01
35} -start
36
37shell {
38 HOST=${h1_fe1_addr}
39 if [ "${h1_fe1_addr}" = "::1" ] ; then
40 HOST="\[::1\]"
41 fi
42
43 md5=$(which md5 || which md5sum)
44
45 if [ -z $md5 ] ; then
46 echo "MD5 checksum utility not found"
47 exit 1
48 fi
49
50 expectchecksum="4d9c62aa5370b8d5f84f17ec2e78f483"
51
52 for opt in "" "--limit-rate 300K" "--limit-rate 500K" ; do
53 checksum=$(curl --max-time 15 --compressed -k "https://$HOST:${h1_fe1_port}" $opt | $md5 | cut -d ' ' -f1)
54 if [ "$checksum" != "$expectchecksum" ] ; then
55 echo "Expecting checksum $expectchecksum"
56 echo "Received checksum: $checksum"
57 exit 1;
58 fi
59 done
60
61} -run