blob: af234b3d1c39b199ff0d2e31614eabcda6a5ee10 [file] [log] [blame]
Ilya Shipitsin1e9a6662021-01-05 22:10:46 +05001# Checks that compression doesn't cause corruption..
PiBa-NL4dc3f3b2018-12-23 21:21:51 +01002
3varnishtest "Compression validation"
4#REQUIRE_VERSION=1.6
Christopher Faulet185a6432020-05-26 11:08:59 +02005#REQUIRE_OPTIONS=ZLIB|SLZ,LUA,OPENSSL
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
Willy Tarreaub5e62672020-02-18 14:42:33 +010043 md5=$(command -v md5 || command -v md5sum)
PiBa-NL4dc3f3b2018-12-23 21:21:51 +010044
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