VCL Seems to be ignored?

ken at simplyprecise.com ken at simplyprecise.com
Wed Jul 27 19:38:36 CEST 2011


Hi Matt,

Thanks for the response.

In the beginning of the if statement we have "if (!(" what does the  
exclamation point symbolize there?

Also, here:
req.http.Cookie !~ "member_id=(0|-1)"

This is not the same as saying that the cookie member_id does not have  
the value of 0 or -1?

Thanks again, I appreciate the assistance here.

Quoting "Matthew Wilkes" <matthew at matthewwilkes.co.uk>:

>
> On 2011-07-27, at 1819, ken at simplyprecise.com wrote:
>
>>
>>
>> if (!((req.http.Cookie ~ "member_id=" && req.http.Cookie !~  
>> "member_id=(0|-1)") || req.http.Cookie ~  
>> "(guestSkinChoice|language)"))  {
>> Execute what's here....
>> }
>>
>> What I *think* this should do is only "Execute what's here" if:
>> there is not a member_id cookie
>> there is not a member_id cookie that equals 0 or -1
>>
>> Am I incorrect?
>
> Let's build this up bit by bit:
>
> (req.http.Cookie ~ "member_id=" && req.http.Cookie !~ "member_id=(0|-1)")
>
> There is a cookie with a name ending in 'member_id', and it doesn't  
> with 0 or -1.  We call this the member_id condition.
>
>> (!(member_id condition || req.http.Cookie ~ "(guestSkinChoice|language)"))
>
>
> The next bit is:
>
> req.http.Cookie ~ "(guestSkinChoice|language)"
>
> 'getSkinChoice' or 'language' exists in any cookie name or value.   
> We call this one the preferences condition.
>
>> (!(member_id condition || preferences_condition))
>
> So we end up with a NOT-ed OR, meaning neither.  Hence, your condition means:
>
> There is not a cookie with a name ending in 'member_id', or there is  
> one that starts with 0 or -1. In addition, neither 'getSkinChoice'  
> nor 'language' exist in any cookie name or value.
>
> If you get confused by boolean logic it's best to write the  
> conditions out as nested if statements.
>
> Matt
>
>
>





More information about the varnish-misc mailing list