r3208 - in trunk/varnish-cache/bin: varnishd varnishtest/tests

phk at projects.linpro.no phk at projects.linpro.no
Sun Sep 21 08:49:38 CEST 2008


Author: phk
Date: 2008-09-21 08:49:38 +0200 (Sun, 21 Sep 2008)
New Revision: 3208

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
Fix #326:  Don't emit zerolength verbatim strings before esi:include



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2008-09-21 06:47:37 UTC (rev 3207)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2008-09-21 06:49:38 UTC (rev 3208)
@@ -790,9 +790,11 @@
 	struct object *obj;
 
 	VTAILQ_FOREACH(eb, &sp->obj->esibits, list) {
-		WRK_Write(sp->wrk, eb->chunk_length, -1);
-		WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim));
-		WRK_Write(sp->wrk, "\r\n", -1);
+		if (Tlen(eb->verbatim)) {
+			WRK_Write(sp->wrk, eb->chunk_length, -1);
+			WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim));
+			WRK_Write(sp->wrk, "\r\n", -1);
+		}
 		if (eb->include.b == NULL ||
 		    sp->esis >= params->max_esi_includes)
 			continue;

Added: trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc	2008-09-21 06:49:38 UTC (rev 3208)
@@ -0,0 +1,23 @@
+# $Id: e00008.vtc 3012 2008-07-24 12:22:35Z des $
+
+test "No zerolength verbatim before <esi:include...>"
+
+server s1 {
+	rxreq 
+	txresp -body {<esi:include src="/foo"/><esi:include src="/foo"/>}
+	rxreq 
+	txresp -body "FOO\n"
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		esi;
+	}
+} -start
+
+client c1 {
+	txreq 
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 8
+} -run




More information about the varnish-commit mailing list