Commit 42015170 authored by Geoff Simmons's avatar Geoff Simmons

add test g00006.vtc

parent 2b8f60c3
varnishtest "Backend IMS'ing g[un]zip'ed objects"
server s1 {
rxreq
expect req.url == /1
txresp -hdr "Last-Modified: Wed, 11 Sep 2013 13:36:55 GMT" \
-hdr {ETag: "foozle"} \
-bodylen 20
rxreq
expect req.url == /1
expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT"
txresp -status 304 \
-hdr {ETag: "fizle"} \
-nolen
rxreq
expect req.url == /2
txresp -hdr "Last-Modified: Wed, 11 Sep 2013 13:36:55 GMT" \
-hdr {ETag: "foobar"} \
-gzipbody "012345678901234567"
rxreq
expect req.url == /2
expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT"
txresp -status 304 -hdr "Content-Encoding: gzip,rot13" \
-hdr {ETag: "snafu"} \
-nolen
} -start
varnish v1 -vcl {
import backend_dyn from "${vmod_topbuild}/src/.libs/libvmod_backend_dyn.so";
backend dummy { .host = "${bad_ip}"; }
sub vcl_init {
if (!backend_dyn.create(name="be", host="${s1_addr}",
port="${s1_port}")) {
return(fail);
}
}
sub vcl_recv {
set req.backend_hint = backend_dyn.by_name("be");
}
sub vcl_backend_response {
set beresp.http.foobar = beresp.http.content-encoding;
if (bereq.url == "/1") {
set beresp.do_gzip = true;
} else {
set beresp.do_gunzip = true;
}
set beresp.ttl = 1s;
set beresp.grace = 0s;
set beresp.keep = 60s;
}
} -start
client c1 {
txreq -url /1 -hdr "Accept-Encoding: gzip"
rxresp
expect resp.http.content-encoding == "gzip"
expect resp.http.foobar == ""
expect resp.http.etag == {W/"foozle"}
gunzip
expect resp.bodylen == 20
delay 1
txreq -url /1 -hdr "Accept-Encoding: gzip"
rxresp
expect resp.http.content-encoding == "gzip"
expect resp.http.foobar == "gzip"
expect resp.http.etag == {W/"fizle"}
gunzip
expect resp.bodylen == 20
delay .2
txreq -url /2
rxresp
expect resp.http.content-encoding == "<undef>"
expect resp.http.foobar == "gzip"
expect resp.bodylen == 18
expect resp.http.etag == {W/"foobar"}
delay 1
txreq -url /2
rxresp
expect resp.http.content-encoding == "<undef>"
# Here we see the C-E of the IMS OBJ
expect resp.http.foobar == ""
expect resp.http.etag == {W/"snafu"}
expect resp.bodylen == 18
} -run
varnish v1 -expect VBE.vcl1.be.happy == 0
varnish v1 -expect MAIN.n_backend == 2
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