[Varnish] #900: The \" escape does not work.

Varnish varnish-bugs at varnish-cache.org
Mon May 16 14:30:04 CEST 2011


#900: The \" escape does not work.
----------------------+-----------------------------------------------------
 Reporter:  kristian  |       Owner:       
     Type:  defect    |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
----------------------+-----------------------------------------------------

Comment(by kristian):

 While the above is fixed, this is now an issue.

 To ban \foo, the \ needs to be escaped in the ban() function of VCL. This
 seems to be somewhat flawed. VCL first.

 VCL
 {{{
 backend foo {
         .host = "kly.no";
 }

 sub vcl_recv {
         if (req.url ~ "ban") {
                 ban("req.url ~ \digit1");
                 ban("req.url ~ \\digit2");
                 ban("req.url ~ \\\digit3");
                 ban("req.url ~ \\\\digit4");
                 ban("req.url ~ \\\\\digit5");

                 error 200 "BANNED";
         }
 }
 }}}

 After a request to blatti followed by /ban (note that \d is a valid regex
 matching digits.):

 {{{

 ban.list
 200 117
 0x7f68ad118080 1305548665.244920     0  req.url ~ \\digit4
 0x7f68ad118040 1305548665.244900     0  req.url ~ \digit2

 }}}

 This is also not all that neat on CLI. This is after adding a single
 object to the cache:
 {{{

 stop
 Stopping Child
 200 0

 Child (29754) said Child dies
 Child (29754) died
 Child cleanup complete
 start
 child (29775) Started
 200 0

 Child (29775) said Child starts
 ban req.url ~ \digit1
 100 85
 Unknown request.
 Type 'help' for more info.
 Syntax Error: Invalid backslash sequence

 ban req.url ~ \\digit2
 100 85
 Unknown request.
 Type 'help' for more info.
 Syntax Error: Invalid backslash sequence

 ban req.url ~ \\\digit3
 100 85
 Unknown request.
 Type 'help' for more info.
 Syntax Error: Invalid backslash sequence

 ban req.url ~ \\\\digit4
 200 0

 ban req.url ~ \\\\\digit5
 100 85
 Unknown request.
 Type 'help' for more info.
 Syntax Error: Invalid backslash sequence

 ban.list
 200 58
 0x7f68b5819f40 1305548943.609118     0  req.url ~ \digit4
 }}}

-- 
Ticket URL: <http://www.varnish-cache.org/trac/ticket/900#comment:1>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list