Mailing List Archive

Cookie VMOD keep/filter documentation issue
Hi all,

I'm confused on whether cookie.keep_re? and cookie.filter_re? should work with CSV strings. The documentation at https://varnish-cache.org/docs/trunk/reference/vmod_cookie.html does not explicitly say that those two functions can take a CSV string like the docs for keep? and filter? do, but the example for keep_re? uses such string, indicating that it should be able to. However, testing with varnishtest? definitely shows that the _re? functions do not work with CSV strings. Can anyone clarify what the truth is supposed to be?

Thanks,
Justin
Re: Cookie VMOD keep/filter documentation issue [ In reply to ]
On Tue, Apr 6, 2021 at 4:11 PM Justin Lloyd <justinl@arena.net> wrote:
>
> Hi all,
>
> I'm confused on whether cookie.keep_re and cookie.filter_re should work with CSV strings. The documentation at https://varnish-cache.org/docs/trunk/reference/vmod_cookie.html does not explicitly say that those two functions can take a CSV string like the docs for keep and filter do, but the example for keep_re uses such string, indicating that it should be able to. However, testing with varnishtest definitely shows that the _re functions do not work with CSV strings. Can anyone clarify what the truth is supposed to be?

Hi,

Looking at the examples right now it is clear [1] that filter() and
keep() each take a CSV string. It is also clear [1] that filter_re()
takes a single regular expression [2]. However, the keep_re()
example is both misleading and wrong.

Thanks for bringing this to our attention!

https://github.com/varnishcache/varnish-cache/commit/606977bbfb624ead38e9c8648beac0b3906a4294

Dridi

[1] to me
[2] not to be confused with a singular expression
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Cookie VMOD keep/filter documentation issue [ In reply to ]
Hi Dridi,

Thanks for confirming that! However, is there then a way to get the effect of being able to pass a regex to keep_re() and filter_re()? I just started working with the cookie vmod this morning and this would be a useful feature. As I understand it, Varnish 6.4 (we're on 6.5) replaced filter() and filter_except() with keep() and keep_re() and that the previous functions could take CSV strings.

Thanks,
Justin

________________________________
From: Dridi Boukelmoune <dridi@varni.sh>
Sent: Tuesday, April 6, 2021 10:29 AM
To: Justin Lloyd <justinl@arena.net>
Cc: varnish-misc@varnish-cache.org <varnish-misc@varnish-cache.org>
Subject: Re: Cookie VMOD keep/filter documentation issue

On Tue, Apr 6, 2021 at 4:11 PM Justin Lloyd <justinl@arena.net> wrote:
>
> Hi all,
>
> I'm confused on whether cookie.keep_re and cookie.filter_re should work with CSV strings. The documentation at https://varnish-cache.org/docs/trunk/reference/vmod_cookie.html does not explicitly say that those two functions can take a CSV string like the docs for keep and filter do, but the example for keep_re uses such string, indicating that it should be able to. However, testing with varnishtest definitely shows that the _re functions do not work with CSV strings. Can anyone clarify what the truth is supposed to be?

Hi,

Looking at the examples right now it is clear [1] that filter() and
keep() each take a CSV string. It is also clear [1] that filter_re()
takes a single regular expression [2]. However, the keep_re()
example is both misleading and wrong.

Thanks for bringing this to our attention!

https://github.com/varnishcache/varnish-cache/commit/606977bbfb624ead38e9c8648beac0b3906a4294

Dridi

[1] to me
[2] not to be confused with a singular expression
Re: Cookie VMOD keep/filter documentation issue [ In reply to ]
Forget I asked, that was a dumb question since it's a regex and | can be used. /sigh

Justin

________________________________
From: Justin Lloyd <justinl@arena.net>
Sent: Tuesday, April 6, 2021 10:35 AM
To: Dridi Boukelmoune <dridi@varni.sh>
Cc: varnish-misc@varnish-cache.org <varnish-misc@varnish-cache.org>
Subject: Re: Cookie VMOD keep/filter documentation issue

Hi Dridi,

Thanks for confirming that! However, is there then a way to get the effect of being able to pass a regex to keep_re() and filter_re()? I just started working with the cookie vmod this morning and this would be a useful feature. As I understand it, Varnish 6.4 (we're on 6.5) replaced filter() and filter_except() with keep() and keep_re() and that the previous functions could take CSV strings.

Thanks,
Justin

________________________________
From: Dridi Boukelmoune <dridi@varni.sh>
Sent: Tuesday, April 6, 2021 10:29 AM
To: Justin Lloyd <justinl@arena.net>
Cc: varnish-misc@varnish-cache.org <varnish-misc@varnish-cache.org>
Subject: Re: Cookie VMOD keep/filter documentation issue

On Tue, Apr 6, 2021 at 4:11 PM Justin Lloyd <justinl@arena.net> wrote:
>
> Hi all,
>
> I'm confused on whether cookie.keep_re and cookie.filter_re should work with CSV strings. The documentation at https://varnish-cache.org/docs/trunk/reference/vmod_cookie.html does not explicitly say that those two functions can take a CSV string like the docs for keep and filter do, but the example for keep_re uses such string, indicating that it should be able to. However, testing with varnishtest definitely shows that the _re functions do not work with CSV strings. Can anyone clarify what the truth is supposed to be?

Hi,

Looking at the examples right now it is clear [1] that filter() and
keep() each take a CSV string. It is also clear [1] that filter_re()
takes a single regular expression [2]. However, the keep_re()
example is both misleading and wrong.

Thanks for bringing this to our attention!

https://github.com/varnishcache/varnish-cache/commit/606977bbfb624ead38e9c8648beac0b3906a4294

Dridi

[1] to me
[2] not to be confused with a singular expression
Re: Cookie VMOD keep/filter documentation issue [ In reply to ]
On Tue, Apr 6, 2021 at 5:41 PM Justin Lloyd <justinl@arena.net> wrote:
>
> Forget I asked, that was a dumb question since it's a regex and | can be used. /sigh

Yes, "|" is an option.

<snip>
> Hi Dridi,
>
> Thanks for confirming that! However, is there then a way to get the effect of being able to pass a regex to keep_re() and filter_re()? I just started working with the cookie vmod this morning and this would be a useful feature. As I understand it, Varnish 6.4 (we're on 6.5) replaced filter() and filter_except() with keep() and keep_re() and that the previous functions could take CSV strings.

I think there is a misunderstanding here.

We renamed filter_except() to keep() because it had better semantics,
much easier to understand. The filter_re() and keep_re() functions are
regular expression variants for basically the same operations: filtering
some cookies out, or keeping a subset of the cookies.

Cheers,
Dridi
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc