blob: 6baddeae120f114fce3552d31c796e29867d8315 [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
6
7feature ignore_unknown_macro
8
9haproxy h1 -conf {
10global
11# log stdout format short daemon
12 lua-load ${testdir}/s00000.lua
13
14defaults
15 mode http
16 log global
17 ${no-htx} option http-use-htx
18 option httplog
19
20frontend main-https
21 bind "fd@${fe1}" ssl crt ${testdir}/common.pem
22 compression algo gzip
23 compression type text/html text/plain application/json application/javascript
24 compression offload
25 use_backend TestBack if TRUE
26
27backend TestBack
28 server LocalSrv ${h1_fe2_addr}:${h1_fe2_port}
29
30listen fileloader
31 mode http
32 bind "fd@${fe2}"
33 http-request use-service lua.fileloader-http01
34} -start
35
36shell {
37 HOST=${h1_fe1_addr}
38 if [ "${h1_fe1_addr}" = "::1" ] ; then
39 HOST="\[::1\]"
40 fi
41
42 md5=$(which md5 || which md5sum)
43
44 if [ -z $md5 ] ; then
45 echo "MD5 checksum utility not found"
46 exit 1
47 fi
48
49 expectchecksum="4d9c62aa5370b8d5f84f17ec2e78f483"
50
51 for opt in "" "--limit-rate 300K" "--limit-rate 500K" ; do
52 checksum=$(curl --max-time 15 --compressed -k "https://$HOST:${h1_fe1_port}" $opt | $md5 | cut -d ' ' -f1)
53 if [ "$checksum" != "$expectchecksum" ] ; then
54 echo "Expecting checksum $expectchecksum"
55 echo "Received checksum: $checksum"
56 exit 1;
57 fi
58 done
59
60} -run