[Varnish] #266: Fix bug in ESI parser

Varnish varnish-bugs at projects.linpro.no
Wed Jul 2 17:32:55 CEST 2008


#266: Fix bug in ESI parser
----------------------+-----------------------------------------------------
 Reporter:  sky       |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  high      |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
----------------------+-----------------------------------------------------
 Currently, if the ESI parser sees an open tag, it tries to find the end of
 it, leading to problems if you have open < for other reasons.

 Example is

 xxx<?xxxxxxx<esi:include src="http://test/halo/arturxxxx.txt"/>after

 which renders incorrectly without the patch

 xxx<?xxxxxxx<esi:include src="http://test/halo/arturxxxx.txt"/>after

 with the patch you get

 xxx<?xxxxxxxinside esiafter

 {{{
 Index: bin/varnishd/cache_vrt_esi.c
 ===================================================================
 --- bin/varnishd/cache_vrt_esi.c        (revision 2877)
 +++ bin/varnishd/cache_vrt_esi.c        (working copy)
 @@ -454,6 +454,14 @@
                         continue;
                 }

 +               if(memcmp(p, "<esi:", i > 5 ? 5 : i)) {
 +                       /* If this is not an esi tag, then there is no
 point in
 +                          treating it like one, just continue
 +                          otherwise we are dependent on well formed HTML
 */
 +                       p++;
 +                       continue;
 +               }
 +
                 /* Find end of this element */
                 for (q = p + 1; q < t.e && *q != '>'; q++)
                         continue;

 }}}

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/266>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list