From 39f5a0a1c54bc004aa82cf7b8334f4c811da6270 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 29 Oct 2007 08:16:22 +0000 Subject: [PATCH] If we find no ESI elements of an object, don't penalize it with ESI's chunked delivery. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2179 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt_esi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index c404a050..81ee262f 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -76,6 +76,7 @@ struct esi_work { struct esi_bit *eb; struct esi_bit *ebl; /* list of */ int neb; + int is_esi; }; /*-------------------------------------------------------------------- @@ -361,6 +362,7 @@ esi_parse(struct esi_work *ew) * 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 @@ esi_parse(struct esi_work *ew) 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 @@ esi_parse(struct esi_work *ew) if (r + 10 < q && !memcmp(r, "esi:include", 11)) { + ew->is_esi++; + o.e = p; esi_addverbatim(ew, o); @@ -547,11 +553,15 @@ VRT_ESI(struct sess *sp) 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 -- 2.39.5