Varnish 3.0.2 req.hash

gau at gprj.net gau at gprj.net
Sat Feb 11 02:22:45 CET 2012


Hugues,

req.hash is the original write-only.(If my memory serves me)
and, VCL is a notation has changed Varnish3.
req.hash is replaced to hash_data();


 vcl:
 sub vcl_hash {
     hash_data(req.url);
     set req.http.X-TEST = req.url; //add
     if (req.http.host) {
         hash_data(req.http.host);
         set req.http.X-TEST = req.http.X-TEST + " + "  + req.http.host; //add
     } else {
        hash_data(server.ip);
        set req.http.X-TEST = req.http.X-TEST + " + " + server.ip; //add
     }
     return (hash);
 }


  sub vcl_deliver{
      set resp.http.X-TEST = req.http.X-TEST;
  }

 test:
  wget  -d http://192.168.1.199:6081/test -O - > /dev/null

  X-TEST: /test + 192.168.1.199:6081

Is not a very smart.
(Is not a hash, but understood what anything was used)


Can not think only about making the other VMOD.


--
Syohei Tanaka(@xcir)
http://xcir.net/



2012/2/11 Hugues Alary <hugues.alary at gmail.com>:
> 2012/2/10 Roberto O. Fernández Crisial <roberto.fernandezcrisial at gmail.com>
>>
>> Hugues,
>
>
> Hi Roberto,
>
> Thank you for your answer.
>
>>
>>
>> Try this:
>>
>> set req.http.X-TEST = req.hash;
>> set req.http.TEST = req.http.X-TEST;
>>
>> It should work.
>
>
>
> Unfortunately the problem doesn't come from the syntax of "req.http.TEST"
> but from req.hash. Here is the message:
>
> Message from VCC-compiler:
> Symbol not found: 'req.hash' (expected type STRING_LIST):
> ('input' Line 219 Pos 31)
>         set req.http.X-TEST = req.hash;
> ------------------------------########-
>
> Running VCC-compiler failed, exit 1
>
> VCL compilation failed
>
>
> I also tried to put that in my configuration:
>
> set req.http.X-TEST = {""} + req.hash;
>
>
> And, same error:
>
> Message from VCC-compiler:
> Symbol not found: 'req.hash' (expected type STRING):
> ('input' Line 219 Pos 38)
>         set req.http.X-TEST = {""} + req.hash;
> -------------------------------------########-
>
> Running VCC-compiler failed, exit 1
>
> VCL compilation failed
>
>
> Do you have any other idea ?
>
>>
>> Good  luck,
>>
>> Roberto (@rofc)
>>
>
> Thanks!
> -Hugues
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list