Hi Syohey,

Thanks for your answer.

My final goal is to get the hash calculated by Varnish. In the
documentation of the 3.0.2 version it is written that req.hash contains
this hash. I guess they just forgot to remove it and that req.hash doesn't
exist anymore.

However, is there a mean to get the *final* hash calculated by varnish, the
result of hash_data()?

Here:
https://www.varnish-cache.org/docs/trunk/phk/varnish_does_not_hash.html it
is written:


"All the strings hash_data() are fed, are pushed through a cryptographic
hash algorithm called SHA256, which, as the name says, always spits out 256
bits (= 32 bytes), no matter how many bits you feed it."

And that's what I am looking for, the final value of the hash. I guess I
could do it myself with a bit of C, but I would think that it is possible
to get this value from somewhere since Varnish already does the calculation.

-Hugues

On Fri, Feb 10, 2012 at 5:22 PM, [email protected] <[email protected]> wrote:

> 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 <[email protected]>:
> > 2012/2/10 Roberto O. Fernández Crisial <
> [email protected]>
> >>
> >> 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
> > [email protected]
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



-- 
Hugues ALARY
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to