[PATCH] HttpRequest::helperNotes to NotePairs

From: Tsantilas Christos <chtsanti_at_users.sourceforge.net>
Date: Fri, 15 Mar 2013 20:11:42 +0200

This patch converts the HttpRequest::helperNotes to a NotePairs object
This patch is similar with the one posted under the "Helper and Notes"
thread and just add a new method:
   NotePairs::hasPair to check if a key/value pair is stored

We need to discuss, how to handle multiple notes with the same key.
Assume that you have the following answer from a helper:
   OK user="J, Smith" group="group1,A" group=group2

Currently (with or without this patch), formating code "%note{group}"
will print:
      "group1,A,group2"

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.

How should we handle this case? Is it OK as is?

We need to decide if the ',' will be used as separator or as valid
values character.

Case1: Consider ',' as valid values separator
-------------------------------------------------

We may be able to use easier syntax like the following:
   ok X-Cert-Errors=Err1,Err2,Err3
instead of requiring syntax like the following:
   ok X-Cert-Errors=Err1 X-Cert-Errors=Err2 X-Cert-Errors=Err3

For icap this is means that we are allowing headers:
   "X-Cert-Errors:Err1, Err2, Err3"

If we implement a note ACL, we may support the following acls:
acl CertErr2Or3Note note X-Cert-Errors Err2 Err3

But in this case we may need to find a way to allow user include ',' in
values (maybe use %xx syntax?)

Case 2: Consider the ',' as valid note values char
------------------------------------------------------

The patch maybe needs some more work:
 - Split headers like the X-Cert-Errors to the following note pairs:
X-Cert-Errors=Err1 X-Cert-Errors=Err2 X-Cert-Errors=Err3
   This is can be done in a separate patch, or leave it as TODO
 - Rename the NotePairs::hasPair to something else.

Regards,
   Christos

Received on Fri Mar 15 2013 - 18:11:58 MDT

This archive was generated by hypermail 2.2.0 : Sat Mar 16 2013 - 12:00:07 MDT