note macro - %{policy_}note passes old values along with new value

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

note macro - %{policy_}note passes old values along with new value

Amish
Hello,

I have setup auth_param as follows:

auth_param basic program /usr/lib/squid/user_auth

Where user_auth authenticates user from a database and replies with a
kv-pair as follows.

OK policy_=onlysomesites

Where policy_ (with underscore) is user policy picked from database.

This policy is passed on to url_rewrite_program via url_rewrite_extras
as above.

url_rewrite_program /usr/lib/squid/url_rewrite
url_rewrite_extras "policy=%{policy_}note"

url_rewrite reads URL and the policy supplied (policy=onlysomesites) and
allows or denies URL based on the policy.

Now if I change the policy in database. (to say allsites). Then for new
requests user_auth returns with:
OK policy_=allsites

Now I was expecting that %{policy_}note will pass on only latest value
to url_rewrite but somehow it passes old value + new value.

i.e. it passes "policy=onlysomesites,allsites"

How to pass only the latest value with note macro?

Please guide

Thank you

Amish.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: note macro - %{policy_}note passes old values along with new value

Alex Rousskov
On 12/14/18 9:26 AM, Amish wrote:

> url_rewrite_program /usr/lib/squid/url_rewrite
> url_rewrite_extras "policy=%{policy_}note"

> I was expecting that %{policy_}note will pass on only latest value
> to url_rewrite but somehow it passes old value + new value.

Modern[1] Squid versions should remove old same-name annotations when
adding new ones. If you are running a supported version, and your Squid
merges/appends annotations, consider filing a bug report.


> How to pass only the latest value with note macro?

With modern Squids, you should not do anything special to accomplish
that. Only the latest annotation value should be preserved. If that is
not happening in your tests, consider filing a bug report, especially if
you can reproduce with Squid v4+.

[1]
https://github.com/squid-cache/squid/commit/457857fe7cf51037cd9e54e86c0985391d7ea594

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: note macro - %{policy_}note passes old values along with new value

Amish


On 14/12/18 10:37 pm, Alex Rousskov wrote:
On 12/14/18 9:26 AM, Amish wrote:

url_rewrite_program /usr/lib/squid/url_rewrite
url_rewrite_extras "policy=%{policy_}note"

      
I was expecting that %{policy_}note will pass on only latest value
to url_rewrite but somehow it passes old value + new value.
Modern[1] Squid versions should remove old same-name annotations when
adding new ones. If you are running a supported version, and your Squid
merges/appends annotations, consider filing a bug report.


Sorry that I forgot to mention squid version.

But I am using squid 4.4 (Arch Linux)


      
How to pass only the latest value with note macro?
With modern Squids, you should not do anything special to accomplish
that. Only the latest annotation value should be preserved. If that is
not happening in your tests, consider filing a bug report, especially if
you can reproduce with Squid v4+.

[1]
https://github.com/squid-cache/squid/commit/457857fe7cf51037cd9e54e86c0985391d7ea594

I have not set any clt_conn_tag=TAG.

Does this feature of latest note value work only if I set clt_conn_tag=TAG?

If yes, do you mean I need to set clt_conn_tag=policy_?

Will file bug report if answer is no.

Thanks

Amish.


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: note macro - %{policy_}note passes old values along with new value

Alex Rousskov
On 12/14/18 4:26 PM, Amish wrote:
> On 14/12/18 10:37 pm, Alex Rousskov wrote:
>> On 12/14/18 9:26 AM, Amish wrote:

>>> How to pass only the latest value with note macro?

>> With modern Squids, you should not do anything special to accomplish
>> that. Only the latest annotation value should be preserved. If that is
>> not happening in your tests, consider filing a bug report, especially if
>> you can reproduce with Squid v4+.

>> https://github.com/squid-cache/squid/commit/457857fe7cf51037cd9e54e86c0985391d7ea594

> I have not set any clt_conn_tag=TAG.
>
> Does this feature of latest note value work only if I set clt_conn_tag=TAG?

No, the two are pretty much unrelated. The always-erase-the-old-value
fix (not really a feature!) in the above-referenced commit should apply
to all annotations, not just client connection annotations. IIRC, our
connection annotation work simply exposed the fact that we screwed up
with annotation updates earlier, and we fixed that bug in the same project.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: note macro - %{policy_}note passes old values along with new value

Amish


On 15/12/18 5:27 am, Alex Rousskov wrote:

>>> With modern Squids, you should not do anything special to accomplish
>>> that. Only the latest annotation value should be preserved. If that is
>>> not happening in your tests, consider filing a bug report, especially if
>>> you can reproduce with Squid v4+.
>>> https://github.com/squid-cache/squid/commit/457857fe7cf51037cd9e54e86c0985391d7ea594
> No, the two are pretty much unrelated. The always-erase-the-old-value
> fix (not really a feature!) in the above-referenced commit should apply
> to all annotations, not just client connection annotations. IIRC, our
> connection annotation work simply exposed the fact that we screwed up
> with annotation updates earlier, and we fixed that bug in the same project.
>
> Alex.

Bug report with steps to reproduce filed:

https://bugs.squid-cache.org/show_bug.cgi?id=4912

Amish
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users