Commit b470a652 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

When running with gzip support enabled, ignore "accept-encoding" in

vary-matching.  Varnish will adapt whatever we find to the clients
abilities as necessary.
parent 9469d952
......@@ -144,6 +144,24 @@ VRY_Match(const struct sess *sp, const unsigned char *vary)
while (*vary) {
if (params->http_gzip_support &&
!strcasecmp(H_Accept_Encoding, (const char*)vary)) {
/*
* If we do gzip processing, we do not vary on
* Accept-Encoding, because we want everybody to
* get the gzip'ed object, and varnish will gunzip
* as necessary. We implement the skip at check
* time, rather than create time, so that object
* in persistent storage can be used with either
* setting of http_gzip_support.
*/
vary += *vary + 2;
l = vary[0] * 256 + vary[1];
vary += 2;
if (l != 0xffff)
vary += l;
continue;
}
/* Look for header */
i = http_GetHdr(sp->http, (const char*)vary, &h);
vary += *vary + 2;
......
# $Id$
test "Test that esi+gzip correctly bypasses Vary: accept-encoding"
server s1 {
rxreq
expect req.http.accept-encoding == gzip
txresp -hdr "Vary: Accept-encoding" -gzipbody {FOO}
} -start
varnish v1 -vcl+backend { } -start
client c1 {
txreq -hdr "Accept-encoding: gzip"
rxresp
expect resp.http.content-encoding == gzip
expect resp.status == 200
gunzip
expect resp.bodylen == 3
txreq
rxresp
expect resp.http.content-encoding == resp.http.content-encoding
expect resp.status == 200
expect resp.bodylen == 3
} -run
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