lowercasing request - varnish 4

Brice Burgess nesta at iceburg.net
Tue Sep 30 06:46:48 CEST 2014


Hi,

The varnish-4 Hashing documentation states; "It is worth pointing out 
that Varnish doesn't lowercase the hostname or the URL before hashing it 
so in theory having "Varnish.org/" and "varnish.org/" would result in 
different cache entries."

I would like to lowercase both the host and url during my normalization 
routines in vcl_recv. Stackoverflow has an example using embedded C;

===

|C{
     #include  <ctype.h>
     static  void  strtolower(const  char  *s)  {
         register  char  *c;
         for  (c=s;  *c;  c++)  {
             if  (isupper(*c))  {
                 *c=  tolower(*c);
             }
         }
         return;
     }
}C

sub vcl_recv{
    C{
         strtolower(VRT_r_req_url(sp));
    }C
}
===

Is this the recommended approach -- and will it work with the variable definition changes in varnish 4? (I'm worried||VRT_r_req_url|(sp) may break).

Also -- what is the variable holding the Host string? Is VRT_r_req_host(sp) valid in varnish-4?

Many thanks,

~ Brice

  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140929/4cb06109/attachment.html>


More information about the varnish-misc mailing list