Re: Helpers and Notes

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Mon, 28 Jan 2013 14:02:33 +0200

On 01/28/2013 01:51 PM, Tsantilas Christos wrote:
> To summarize, lets try to see what we currently have and then see what
> we need.
I am answering to my self.

> Currently:
> 1) the helpers may return multiple kv-pairs
Not bad.

> 2) the helper may use non valid characters for HTTP headers for key
> names. This is work well now, but we are worrying that in the future it
> may not work, because the HttpHeader API will be changed.

 If we are worrying we can re-implement NotePairs class to not use the
HttpHeader class. However I should not here that using the HttpHeader is
very useful on implementing the "%note" log format.
In any case I do not believe that it is not huge problem because the key
names can be controlled by the developers (squid or helper developers)

> 3) the helper currently can return a quoted value eg group="J, Smith"
> OR a url encoded value eg group=J%2C%20Smith.

We can always store the value to the NotePairs class using quotes:
NotePairs->add("group", "\"J, Smith\"" ). This is will help log printing
(points 6 &7). The %note{group} will print:
    "group1,A", "group2"

Just a thought...

> 4) the helper may return multiple kv-pairs with the same key

Not bad. But if the helper developer wants to return multiple values
for a key we must find a way to handle them, Not only the first value.

> 5) In most cases(?) used only the first returned value for a key. For
> example if multiple "tag=" kv-pairs returned by the helper only the
> first will be used in tag ACL.

We should fix this. For example if multiple tag= used then the "tag" acl
should handle all of the returned values. I am suggesting two different
ways:
   a) support regex in tag acls. We can enable it using the "-e" flag in
acls or just use the regex:"Value" in acls to specify that a regex
expression should used to match this acl value.
   b) The tag acl will modified to match ANY of the strings in list

I am suggesting the first, having in my mind some ICAP possible
features implemented in the future, but also will help helper developers
to handle better the "tag" acl.

> 6) If more than one kv-pairs with the same key returned then in
> access-log we will print them as a list. For example if the helper
> returned 'OK user="J, Smith" group="group1,A" group=group2' the
> formating code "%note{group}" will print:
> group1,A,group2

I think we should print something like the following:
" group1,A", "group2"

> 7) In the above helper reply the formating code %note will print:
> "user: J, Smith\r\ngroup: group1,A\r\ngroup: group2"
> I must note here that the two "group" kv-pair keys will be printed as
> separate entries.
>
Looks OK.
Received on Mon Jan 28 2013 - 12:02:47 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 28 2013 - 12:00:12 MST