PiBa-NL | 4dc3f3b | 2018-12-23 21:21:51 +0100 | [diff] [blame] | 1 | # Checks that compression doesnt cause corruption.. |
| 2 | |
| 3 | varnishtest "Compression validation" |
| 4 | #REQUIRE_VERSION=1.6 |
Christopher Faulet | 185a643 | 2020-05-26 11:08:59 +0200 | [diff] [blame] | 5 | #REQUIRE_OPTIONS=ZLIB|SLZ,LUA,OPENSSL |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 6 | #REGTEST_TYPE=slow |
PiBa-NL | 4dc3f3b | 2018-12-23 21:21:51 +0100 | [diff] [blame] | 7 | |
| 8 | feature ignore_unknown_macro |
| 9 | |
| 10 | haproxy h1 -conf { |
| 11 | global |
| 12 | # log stdout format short daemon |
Frédéric Lécaille | b894f92 | 2019-03-29 16:13:48 +0100 | [diff] [blame] | 13 | lua-load ${testdir}/lua_validation.lua |
PiBa-NL | 4dc3f3b | 2018-12-23 21:21:51 +0100 | [diff] [blame] | 14 | |
| 15 | defaults |
| 16 | mode http |
| 17 | log global |
| 18 | ${no-htx} option http-use-htx |
| 19 | option httplog |
| 20 | |
| 21 | frontend 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 | |
| 28 | backend TestBack |
| 29 | server LocalSrv ${h1_fe2_addr}:${h1_fe2_port} |
| 30 | |
| 31 | listen fileloader |
| 32 | mode http |
| 33 | bind "fd@${fe2}" |
| 34 | http-request use-service lua.fileloader-http01 |
| 35 | } -start |
| 36 | |
| 37 | shell { |
| 38 | HOST=${h1_fe1_addr} |
| 39 | if [ "${h1_fe1_addr}" = "::1" ] ; then |
| 40 | HOST="\[::1\]" |
| 41 | fi |
| 42 | |
Willy Tarreau | b5e6267 | 2020-02-18 14:42:33 +0100 | [diff] [blame] | 43 | md5=$(command -v md5 || command -v md5sum) |
PiBa-NL | 4dc3f3b | 2018-12-23 21:21:51 +0100 | [diff] [blame] | 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 |