Commit 16a0f597 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make sure we handle segmentet storage correctly when gunzip'ing

a response.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5697 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b63ed5d8
......@@ -119,6 +119,7 @@ VGZ_Feed(struct vgz *vg, const void *ptr, size_t len)
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
AZ(vg->vz.avail_in);
vg->vz.next_in = TRUST_ME(ptr);
vg->vz.avail_in = len;
......@@ -126,7 +127,7 @@ VGZ_Feed(struct vgz *vg, const void *ptr, size_t len)
}
/*--------------------------------------------------------------------*/
#include <stdio.h>
int
VGZ_Produce(struct vgz *vg, const void **pptr, size_t *plen)
{
......@@ -148,6 +149,9 @@ VGZ_Produce(struct vgz *vg, const void **pptr, size_t *plen)
return (0);
if (i == Z_STREAM_END)
return (1);
if (i == Z_BUF_ERROR)
return (2);
fprintf(stderr, "--------------------> GUNZIP = %d\n", i);
return (-1);
}
......
......@@ -275,6 +275,7 @@ res_WriteGunzipObj(struct sess *sp, char lenbuf[20])
if (WRW_Flush(sp->wrk))
break;
}
assert(i >= 0);
} while (i == 0);
}
VGZ_Destroy(&vg);
......
# $Id$
test "test basic gunzip for client"
server s1 {
rxreq
expect req.http.accept-encoding == "gzip"
expect req.url == "/foo"
txresp -nolen -gziplen 4100
accept
rxreq
expect req.url == "/bar"
txresp -body {<H1><esi:include src="/foo"/></H1>}
} -start
varnish v1 -cliok "param.set http_gzip_support true" -vcl+backend {
sub vcl_fetch {
esi;
}
} -start
varnish v1 -cliok "param.set fetch_chunksize 4"
client c1 {
txreq -url /foo -hdr "Accept-Encoding: gzip"
rxresp
gunzip
expect resp.http.content-encoding == "gzip"
expect resp.bodylen == 4100
} -run
# If this fails, the multiple storage allocations did not happen
varnish v1 -expect SMF.s0.nreq == 3
client c1 {
# See varnish can gunzip it.
txreq -url /foo -hdr "Accept-Encoding: null"
rxresp
expect resp.http.content-encoding == "resp.http.content-encoding"
expect resp.bodylen == 4100
# See varnish can gunzip it, inside ESI
txreq -url /bar -hdr "Accept-Encoding: null"
rxresp
expect resp.http.content-encoding == "resp.http.content-encoding"
expect resp.bodylen == 4109
# See varnish can deliver gzip'ed ESI (NOTYET)
#txreq -url /bar -hdr "Accept-Encoding: gzip"
#rxresp
# expect resp.http.content-encoding == "gzip"
#gunzip
#expect resp.bodylen == 4109
} -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