[3.0] ce09d2e Add a missing case: ESI parent document gunzip'ed but included document gzip'ed.

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 16 10:20:35 CEST 2012


commit ce09d2ed973b3771d82eac0384295ddf0f0921fc
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 afef1fb..3f3ab2b 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -801,7 +801,7 @@ VEP_parse(const struct sess *sp, 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 0f7e435..37459d7 100644
--- a/bin/varnishd/cache_response.c
+++ b/bin/varnishd/cache_response.c
@@ -312,6 +312,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