]> err.no Git - varnish/commitdiff
If we find no ESI elements of an object, don't penalize it with ESI's
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 29 Oct 2007 08:16:22 +0000 (08:16 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 29 Oct 2007 08:16:22 +0000 (08:16 +0000)
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

index c404a0503b57e84d6a0bb430c134c393dbe1bb76..81ee262fdd11421b407f9fcd155a5d7225e39d54 100644 (file)
@@ -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