Hashing on a particular cookie value

Soumendu Bhattacharya soumendu_bhattacharya at non.agilent.com
Thu Nov 8 13:48:20 CET 2012


============================================================================
==================================
Your regex differs than mine.  One negligible difference and one that I'll
focus on.  The negligible difference being the anchors "^" and "$".
They aren't necessary.

For reference, my regex was:
regsub(req.http.cookie, ".*mycookie=([^;]+);.*",

                                         ^
                                         ^

The difference is that I'm looking for a value in my regex, and you don't
care if there is a value in yours.  '+' vs '*'.

Your regex matches:
mycookie=
mycookie=a
mycookie=abc
...

My regex _doesn't_ match:
mycookie=

If you want to hash on an empty cookie, then your regex is what you want.
Otherwise, perhaps mine is what you want.
============================================================================
=======================
Thanks - a lot - I will change my regex :)  I certainly don't want to hash
on empty cookie. 

Regards

Soumendu





More information about the varnish-misc mailing list