blob: b10cbd93e71fdc51c555a653a72da3c55563d176 [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"
Christopher Faulet185a6432020-05-26 11:08:59 +02004#REQUIRE_OPTIONS=ZLIB|SLZ,LUA,OPENSSL
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +01005#REGTEST_TYPE=slow
PiBa-NL4dc3f3b2018-12-23 21:21:51 +01006
7feature ignore_unknown_macro
8
9haproxy h1 -conf {
10global
11# log stdout format short daemon
Frédéric Lécailleb894f922019-03-29 16:13:48 +010012 lua-load ${testdir}/lua_validation.lua
PiBa-NL4dc3f3b2018-12-23 21:21:51 +010013
14defaults
15 mode http
16 log global
PiBa-NL4dc3f3b2018-12-23 21:21:51 +010017 option httplog
18
19frontend main-https
20 bind "fd@${fe1}" ssl crt ${testdir}/common.pem
21 compression algo gzip
22 compression type text/html text/plain application/json application/javascript
23 compression offload
24 use_backend TestBack if TRUE
25
26backend TestBack
27 server LocalSrv ${h1_fe2_addr}:${h1_fe2_port}
28
29listen fileloader
30 mode http
31 bind "fd@${fe2}"
32 http-request use-service lua.fileloader-http01
33} -start
34
35shell {
36 HOST=${h1_fe1_addr}
37 if [ "${h1_fe1_addr}" = "::1" ] ; then
38 HOST="\[::1\]"
39 fi
40
Willy Tarreaub5e62672020-02-18 14:42:33 +010041 md5=$(command -v md5 || command -v md5sum)
PiBa-NL4dc3f3b2018-12-23 21:21:51 +010042
43 if [ -z $md5 ] ; then
44 echo "MD5 checksum utility not found"
45 exit 1
46 fi
47
48 expectchecksum="4d9c62aa5370b8d5f84f17ec2e78f483"
49
50 for opt in "" "--limit-rate 300K" "--limit-rate 500K" ; do
51 checksum=$(curl --max-time 15 --compressed -k "https://$HOST:${h1_fe1_port}" $opt | $md5 | cut -d ' ' -f1)
52 if [ "$checksum" != "$expectchecksum" ] ; then
53 echo "Expecting checksum $expectchecksum"
54 echo "Received checksum: $checksum"
55 exit 1;
56 fi
57 done
58
59} -run