Commit f72cbbdf authored by Geoff Simmons's avatar Geoff Simmons

Add the "unbr" VFP for decompression.

parent a655bc0e
......@@ -38,6 +38,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
m4_ifndef([VARNISH_PREREQ], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
PKG_CHECK_MODULES([BROTLIENC], [libbrotlienc])
PKG_CHECK_MODULES([BROTLIDEC], [libbrotlidec])
VARNISH_PREREQ([trunk])
VARNISH_VMODS([brotli])
......
AUTOMAKE_OPTIONS = subdir-objects
AM_CFLAGS = $(VARNISHAPI_CFLAGS) -Wall -Werror -Wextra -std=c99 \
@BROTLIENC_CFLAGS@
@BROTLIENC_CFLAGS@ @BROTLIDEC_CFLAGS@
AM_LDFLAGS = $(VARNISHAPI_LIBS) $(VMOD_LDFLAGS) -ldl
vmod_LTLIBRARIES = libvmod_brotli.la
......@@ -17,7 +17,7 @@ dist_man_MANS = vfp_brotli.3
vfp_brotli.lo: $(nodist_libvmod_brotli_la_SOURCES)
libvmod_brotli_la_LIBADD = @BROTLIENC_LIBS@
libvmod_brotli_la_LIBADD = @BROTLIENC_LIBS@ @BROTLIDEC_LIBS@
vcc_if.h vmod_brotli.rst vmod_brotli.man.rst: vcc_if.c
......
# looks like -*- vcl -*-
varnishtest "brotli decompression"
# Test vectors from github.com/google/brotli/tests/testdata
server s1 {
rxreq
txresp -hdr "Content-Encoding: br" \
-body { The quick brown fox jumps over the lazy dog}
rxreq
txresp -hdr "Content-Encoding: br" -body { Xyzzy}
rxreq
txresp -hdr "Content-Encoding: br" -hdr "Content-Length: 12"
sendhex "1b 13 00 00 a4 b0 b2 ea 81 47 02 8a"
rxreq
txresp -hdr "Content-Encoding: br" -hdr "Content-Length: 10"
sendhex "1b 3f 00 00 24 b0 e2 99 80 12"
rxreq
txresp -hdr "Content-Encoding: br" -hdr "Content-Length: 58"
sendhex "5b ff af 02 c0 22 79 5c fb 5a 8c 42 3b f4 25 55"
sendhex "19 5a 92 99 b1 35 c8 19 9e 9e 0a 7b 4b 90 b9 3c"
sendhex "98 c8 09 40 f3 e6 d9 4d e4 6d 65 1b 27 87 13 5f"
sendhex "a6 e9 30 96 7b 3c 15 d8 53 1c"
rxreq
txresp -hdr "Content-Encoding: br" -hdr "Content-Length: 425"
sendhex "1b 4a 03 00 8c 94 6e de b4 d7 96 b1 78 86 f2 2d"
sendhex "e1 1a bc 0b 1c ba a9 c7 f7 cc 6e b2 42 34 51 44"
sendhex "8b 4e 13 08 a0 cd 6e e8 2c a5 53 a1 9c 5d 2c 1d"
sendhex "23 1a d2 56 be db eb 26 ba 03 65 7c 96 6a a2 76"
sendhex "ec ef 87 47 33 d6 27 0e 63 95 e2 1d 8d 2c c5 d1"
sendhex "28 9f 60 94 6f 02 8b dd aa 64 94 2c 1e 3b 65 7c"
sendhex "07 45 5a b2 e2 fc 49 81 2c 9f 40 ae ef 68 81 ac"
sendhex "16 7a 0f f5 3b 6d 1c b9 1e 2d 5f d5 c8 af 5e 85"
sendhex "aa 05 be 53 75 c2 b0 22 8a 15 c6 a3 b1 e6 42 14"
sendhex "f4 84 54 53 19 5f be c3 f2 1d d1 b7 e5 dd b6 d9"
sendhex "23 c6 f6 9f 9e f6 4d 65 30 fb c0 71 45 04 ad 03"
sendhex "b5 be c9 cb fd e2 50 5a 46 74 04 0d ff 20 04 77"
sendhex "b2 6d 27 bf 47 a9 9d 1b 96 2c 62 90 23 8b e0 f8"
sendhex "1d cf af 1d 3d ee 8a c8 75 23 66 dd de d6 6d e3"
sendhex "2a 82 8a 78 8a db e6 20 4c b7 5c 63 ba 30 e3 3f"
sendhex "b6 ee 8c 22 a2 2a b0 22 0a 99 ff 3d 62 51 ee 08"
sendhex "f6 3d 4a e4 cc ef 22 87 11 e2 83 28 e4 f5 8f 35"
sendhex "19 63 5b e1 5a 92 73 dd a1 50 9d 38 5c eb b5 03"
sendhex "6a 64 90 94 c8 8d fb 2f 8a 86 22 cc 1d 87 e0 48"
sendhex "0a 96 77 90 39 c6 23 23 48 fb 11 47 56 ca 20 e3"
sendhex "42 81 f7 77 32 c1 a5 5c 40 21 65 17 40 29 17 17"
sendhex "6c 56 32 98 38 06 dc 99 4d 33 29 bb 02 df 4c 26"
sendhex "93 6c 17 82 86 20 d7 03 79 7d 9a 00 d7 87 00 e7"
sendhex "0b 66 e3 4c 66 71 67 08 32 f9 08 3e 81 33 cd 17"
sendhex "72 31 f0 b8 94 52 4b 90 31 8e 68 c1 ef 90 c9 e5"
sendhex "f2 61 09 72 25 ad ec c5 62 c0 0b 12 05 f7 91 75"
sendhex "0d ee 61 2e 2e 19 09 c2 03"
rxreq
txresp -hdr "Content-Encoding: br" -hdr "Content-Length: 69"
sendhex "1b 76 00 00 14 4a ac 9b 7a bd e1 97 9d 7f 8e c2"
sendhex "82 36 0e 9c e0 90 03 f7 8b 9e 38 e6 b6 00 ab c3"
sendhex "ca a0 c2 da 66 36 dc cd 80 8d 2e 21 d7 6e e3 ea"
sendhex "4c b8 f0 d2 b8 c7 c2 70 4d 3a f0 69 7e a1 b8 45"
sendhex "73 ab c4 57 1e"
} -start
varnish v1 -vcl+backend {
import ${vmod_brotli};
sub vcl_backend_response {
set beresp.filters = "unbr";
set beresp.uncacheable = true;
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 43
expect resp.body == "The quick brown fox jumps over the lazy dog"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 5
expect resp.body == "Xyzzy"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 20
expect resp.body == "XXXXXXXXXXYYYYYYYYYY"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 64
expect resp.body == "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 176128
# 4096 repetitions
expect resp.body ~ "^The quick brown fox jumps over the lazy dog"
expect resp.body ~ "The quick brown fox jumps over the lazy dog$"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 843
expect resp.body == "znxcvnmz,xvnm.,zxcnv.,xcn.z,vn.zvn.zxcvn.,zxcn.vn.v,znm.,vnzx.,vnzxc.vn.z,vnz.,nv.z,nvmzxc,nvzxcvcnm.,vczxvnzxcnvmxc.zmcnvzm.,nvmc,nzxmc,vn.mnnmzxc,vnxcnmv,znvzxcnmv,.xcnvm,zxcnzxv.zx,qweryweurqioweupropqwutioweupqrioweutiopweuriopweuriopqwurioputiopqwuriowuqerioupqweropuweropqwurweuqriopuropqwuriopuqwriopuqweopruioqweurqweuriouqweopruioupqiytioqtyiowtyqptypryoqweutioioqtweqruowqeytiowquiourowetyoqwupiotweuqiorweuqroipituqwiorqwtioweuriouytuioerytuioweryuitoweytuiweyuityeruirtyuqriqweuropqweiruioqweurioqwuerioqwyuituierwotueryuiotweyrtuiwertyioweryrueioqptyioruyiopqwtjkasdfhlafhlasdhfjklashjkfhasjklfhklasjdfhklasdhfjkalsdhfklasdhjkflahsjdkfhklasfhjkasdfhasfjkasdhfklsdhalghhaf;hdklasfhjklashjklfasdhfasdjklfhsdjklafsd;hkldadfjjklasdhfjasddfjklfhakjklasdjfkl;asdjfasfljasdfhjklasdfhjkaghjkashf;djfklasdjfkljasdklfjklasdjfkljasdfkljaklfj"
txreq
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == <undef>
expect resp.bodylen == 119
expect resp.body == "ukko nooa, ukko nooa oli kunnon mies, kun han meni saunaan, pisti laukun naulaan, ukko nooa, ukko nooa oli kunnon mies."
} -run
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment