[master] 9f15b01 Only do ESI processing if we find some ESI in the object.

Poul-Henning Kamp phk at varnish-cache.org
Wed Apr 20 14:56:14 CEST 2011


commit 9f15b0123e386849e8ce057255c3fa5344c9b744
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Apr 20 12:55:52 2011 +0000

    Only do ESI processing if we find some ESI in the object.

diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index 856d63d..6d30619 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -70,6 +70,7 @@ struct vep_state {
 	/* parser state */
 	const char		*state;
 	unsigned		startup;
+	unsigned		esi_found;
 
 	unsigned		endtag;
 	unsigned		emptytag;
@@ -655,6 +656,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
 					vep_mark_verbatim(vep, p);
 				p++;
 				if (*++vep->esicmt_p == '\0') {
+					vep->esi_found = 1;
 					vep->esicmt = NULL;
 					vep->esicmt_p = NULL;
 					/*
@@ -727,6 +729,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
 			vep->state = VEP_UNTIL;
 		} else if (vep->state == VEP_ESITAG) {
 			vep->in_esi_tag = 1;
+			vep->esi_found = 1;
 			vep_mark_skip(vep, p);
 			vep->match = vep_match_esi;
 			vep->state = VEP_MATCH;
@@ -1055,7 +1058,7 @@ VEP_Finish(const struct sess *sp)
 
 	AZ(vsb_finish(vep->vsb));
 	l = vsb_len(vep->vsb);
-	if (vep->state != VEP_NOTXML && l > 0)
+	if (vep->esi_found && l > 0)
 		return (vep->vsb);
 	vsb_delete(vep->vsb);
 	return (NULL);



More information about the varnish-commit mailing list