[experimental-ims] 374c3a2 Add a missing case: ESI parent document gunzip'ed but included document gzip'ed.
Geoff Simmons
geoff at varnish-cache.org
Mon Jan 9 21:52:28 CET 2012
commit 374c3a235fec63ee4f213696fc43731fd329ac2e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 1 10:49:09 2011 +0000
Add a missing case: ESI parent document gunzip'ed but included
document gzip'ed.
Fixes #1029
diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index 663894a..f6eb367 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -801,7 +801,7 @@ VEP_Parse(const struct worker *w, const char *p, size_t l)
vep->state = VEP_ATTR;
} else if (p < e) {
vep_error(vep,
- "XML 1.0 Illegal attribute tart char");
+ "XML 1.0 Illegal attribute start char");
vep->state = VEP_TAGERROR;
}
} else if (vep->state == VEP_TAGERROR) {
diff --git a/bin/varnishd/cache_response.c b/bin/varnishd/cache_response.c
index 04d2da5..87b0919 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -307,6 +307,9 @@ RES_WriteObj(struct sess *sp)
ESI_Deliver(sp);
} else if (sp->wrk->res_mode & RES_ESI_CHILD && sp->wrk->gzip_resp) {
ESI_DeliverChild(sp);
+ } else if (sp->wrk->res_mode & RES_ESI_CHILD &&
+ !sp->wrk->gzip_resp && sp->obj->gziped) {
+ res_WriteGunzipObj(sp);
} else if (sp->wrk->res_mode & RES_GUNZIP) {
res_WriteGunzipObj(sp);
} else {
diff --git a/bin/varnishtest/tests/r01029.vtc b/bin/varnishtest/tests/r01029.vtc
new file mode 100644
index 0000000..2817bba
--- /dev/null
+++ b/bin/varnishtest/tests/r01029.vtc
@@ -0,0 +1,34 @@
+varnishtest "#1029"
+
+server s1 {
+ rxreq
+ expect req.url == "/bar"
+ txresp -gzipbody {[bar]}
+
+ rxreq
+ expect req.url == "/foo"
+ txresp -body {<h1>FOO<esi:include src="/bar"/>BARF</h1>}
+
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_fetch {
+ set beresp.do_esi = true;
+ if (req.url == "/foo") {
+ set beresp.ttl = 0s;
+ } else {
+ set beresp.ttl = 10m;
+ }
+ }
+} -start
+
+client c1 {
+ txreq -url "/bar" -hdr "Accept-Encoding: gzip"
+ rxresp
+ gunzip
+ expect resp.bodylen == 5
+
+ txreq -url "/foo" -hdr "Accept-Encoding: gzip"
+ rxresp
+ expect resp.bodylen == 21
+} -run
More information about the varnish-commit
mailing list