r2179 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Oct 29 09:16:22 CET 2007


Author: phk
Date: 2007-10-29 09:16:22 +0100 (Mon, 29 Oct 2007)
New Revision: 2179

Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
If we find no ESI elements of an object, don't penalize it with ESI's
chunked delivery.



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2007-10-29 08:09:28 UTC (rev 2178)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2007-10-29 08:16:22 UTC (rev 2179)
@@ -76,6 +76,7 @@
 	struct esi_bit		*eb;
 	struct esi_bit		*ebl;	/* list of */
 	int			neb;
+	int			is_esi;
 };
 
 /*--------------------------------------------------------------------
@@ -361,6 +362,7 @@
 			 * first seven because the tail is handled
 			 * by the incmt flag.
 			 */
+			ew->is_esi++;
 			if (i < 7)
 				return (p - t.b);
 
@@ -426,6 +428,8 @@
 
 		if (r + 9 < q && !memcmp(r, "esi:remove", 10)) {
 
+			ew->is_esi++;
+
 			if (celem != remflg) {
 				/*
 				 * ESI 1.0 violation, ignore element
@@ -468,6 +472,8 @@
 
 		if (r + 10 < q && !memcmp(r, "esi:include", 11)) {
 			
+			ew->is_esi++;
+
 			o.e = p;
 			esi_addverbatim(ew, o);
 
@@ -547,11 +553,15 @@
 			if (VTAILQ_NEXT(st, list))
 				INCOMPL();
 		}
-		i = Tlen(ew->dst);
 	}
 	if (Tlen(ew->dst))
 		esi_addbit(ew);
 
+	if (!ew->is_esi) {
+		ESI_Destroy(sp->obj);
+		return;
+	}
+
 	/*
 	 * Our ESI implementation needs chunked encoding
 	 * XXX: We should only do this if we find any ESI directives




More information about the varnish-commit mailing list