Cookie value compare, integer

Lane, Richard rlane at
Wed Nov 16 13:06:01 CET 2011

Is anyone comparing cookie values that are integers?

I am getting the value of a cookie and then trying to compare it to another integer value but am getting a compile error. Can I compare integers stored in the req object? Should I be going about this a different way?

For example:



    set req.http.compareVal=10;
    set req.http.cookieVal=5;

   call cookieValCompare;


sub cookieValCompare{

     if( req.http.cookieVal < req.http.compareVal)
       #do something extra

If I try to compile via the console I get:

Message from VCC-compiler:
Expected ')' got '<'
(program line 109), at
(/etc/varnish/sitename.vcl Line 11 Pos 28)
      if( req.http.cookieVal < req.http.compareVal )
Running VCC-compiler failed, exit 1VCL compilation failed
Command failed with error code 106
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list