On Tue, Apr 18, 2023 at 12:56 AM Willy Tarreau <[email protected]> wrote:
>
> Hi Jim,
>
> [side note: please guys, avoid top-posting, it makes it very difficult
>  to quote context in responses]

Repenting as fast as I can ...
 * https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
( does a list etiquette guide exist ? )

> On Mon, Apr 17, 2023 at 09:17:03PM -0600, Jim Freeman wrote:
> > Aleksandar - thanks for the feedback ! (haproxy -vv : attached)
> >
> > I'd spent a good long while scouring the config docs (and Google) seeking
> > enlightenment, but ...
> > No joy using either of '! -m found -m int 0' or '! -m found'.
> >
> > Here's hoping someone/anyone else has experience making an empty field()
> > work ...
> (...)
...
> Just a warning below though:
>
> > > >    acl COOK_META_MISSING  req.cook(cook2hdr),field(3,\#) ! -m found -m 
> > > > str ''
>
> I have no idea how that parses to be honest, because a single match
> method may be used and normally whatever follows the first pattern are
> other patterns. Since the "found" match doesn't take any pattern, it's
> likely that "-m str ''" is still parsed and possibly replaces -m found,
> but I wouldn't count on that.
>
> So if you want to consider as missing a cookie that is either not present
> or that is empty, I would probably do it this way:
>
>     acl COOK_META_MISSING  req.cook(cook2hdr),field(3,\#) ! -m found
>     acl COOK_META_MISSING  req.cook(cook2hdr),field(3,\#) -m len 0
>
> This ACL will be true if the cookie's value was not found, or if it
> was found but with an empty length.
>
> hoping this helps,
> Willy

Expressing the acl's OR across multiple lines did indeed help - many thanks !
My sense from googling was that the multiple '-m ...' clauses should
work (and would be more succinct) is hereby proven wrong, and your
explication of the vagaries of second '-m ...' relative to the
preceding one is a very helpful insight and caution flag.
The crux of that I guess is understanding that "whatever follows the
first pattern are other patterns" - that didn't register in my study
of the config docs.
I'd wish to not have to double up the number of lines per field, but
understand that the in-memory expression is very efficient.

As always - HAProxy rocks hardcore and world-class !!

Thanks again,
...jfree

Reply via email to