2021-01-05 17:10:46 +00:00
|
|
|
# Checks that compression doesn't cause corruption..
|
2018-12-23 20:21:51 +00:00
|
|
|
|
|
|
|
varnishtest "Compression validation"
|
2020-05-26 09:08:59 +00:00
|
|
|
#REQUIRE_OPTIONS=ZLIB|SLZ,LUA,OPENSSL
|
2019-03-29 14:07:24 +00:00
|
|
|
#REGTEST_TYPE=slow
|
2018-12-23 20:21:51 +00:00
|
|
|
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
|
|
|
global
|
|
|
|
# log stdout format short daemon
|
2019-03-29 15:13:48 +00:00
|
|
|
lua-load ${testdir}/lua_validation.lua
|
2018-12-23 20:21:51 +00:00
|
|
|
|
|
|
|
defaults
|
|
|
|
mode http
|
|
|
|
log global
|
|
|
|
option httplog
|
|
|
|
|
|
|
|
frontend main-https
|
|
|
|
bind "fd@${fe1}" ssl crt ${testdir}/common.pem
|
|
|
|
compression algo gzip
|
|
|
|
compression type text/html text/plain application/json application/javascript
|
|
|
|
compression offload
|
|
|
|
use_backend TestBack if TRUE
|
|
|
|
|
|
|
|
backend TestBack
|
|
|
|
server LocalSrv ${h1_fe2_addr}:${h1_fe2_port}
|
|
|
|
|
|
|
|
listen fileloader
|
|
|
|
mode http
|
|
|
|
bind "fd@${fe2}"
|
|
|
|
http-request use-service lua.fileloader-http01
|
|
|
|
} -start
|
|
|
|
|
|
|
|
shell {
|
|
|
|
HOST=${h1_fe1_addr}
|
|
|
|
if [ "${h1_fe1_addr}" = "::1" ] ; then
|
|
|
|
HOST="\[::1\]"
|
|
|
|
fi
|
|
|
|
|
2020-02-18 13:42:33 +00:00
|
|
|
md5=$(command -v md5 || command -v md5sum)
|
2018-12-23 20:21:51 +00:00
|
|
|
|
|
|
|
if [ -z $md5 ] ; then
|
|
|
|
echo "MD5 checksum utility not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
expectchecksum="4d9c62aa5370b8d5f84f17ec2e78f483"
|
|
|
|
|
|
|
|
for opt in "" "--limit-rate 300K" "--limit-rate 500K" ; do
|
|
|
|
checksum=$(curl --max-time 15 --compressed -k "https://$HOST:${h1_fe1_port}" $opt | $md5 | cut -d ' ' -f1)
|
|
|
|
if [ "$checksum" != "$expectchecksum" ] ; then
|
|
|
|
echo "Expecting checksum $expectchecksum"
|
|
|
|
echo "Received checksum: $checksum"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
} -run
|