Proposal: Helper response: concatenated values with custom delimiter

Andrey K <[email protected]> Tue, 21 Apr 2026 16:06:03 +0300
Newsgroups gmane.comp.web.squid.devel
Message-ID <CADJd0Y2fXgTkm4nCQw4WqymYFWY0EDUPk_bifHh2bhKvZYC8XQ@mail.gmail.com>
--===============9204576829087824124==
Content-Type: multipart/alternative; boundary="000000000000894537064ff8146f"

--000000000000894537064ff8146f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,

I've mentioned this briefly in another thread, but I=E2=80=99d like to star=
t a
dedicated discussion regarding the support for a "concatenated" value
format in helper responses.

In a recent PR discussion (
https://github.com/squid-cache/squid/pull/2395#discussion_r3022844826),
Alex pointed out issues with using concatenated formats for passing tag
values.

I propose adding support for a custom delimiter for concatenated values
within a single KV-pair in the helper output.

The proposed syntax is:
    <key>=3D<delimiter>"<value1><delimiter><value2>..."

Examples:
    group=3D,"group1,group2,group3"
    clt_con_tag=3D;"tag1;tag2;tag3"

Escaping logic:
    If the delimiter appears inside a value within the token, it must be
double-escaped (\\) by the helper.
For example:
    group=3D,"Staff:accountants\\,lawyers\\,security,Main_Office"
This should produce two separate annotations:
    group=3DStaff:accountants,lawyers,security
    group=3DMain_Office

The choice of double escaping is intentional to maintain consistency with
the way strwordtok() processes quoted values in Squid.
This approach ensures that we can preserve the underlying logic for
handling values while correctly splitting the "glued" tokens.

Currently, a comma-separated format is often used de facto, but Squid
stores these as a single Entry, requiring the -m option for annotation
checks.

Proposed Change:
A minor modification to Helper::Reply::parseResponseKeys().

Pros:
- More compact data transfer format.
- Proper data storage on the Squid side (separate values instead of one
blob).
- Flexibility for plugin developers via custom delimiters.
- Eliminates the need for admins to manually manage the -m option for these
cases.

I am interested in implementing this and submitting a PR. Do you think this
solution is needed and fits the project's direction?

Kind regards,
    Ankor.

--000000000000894537064ff8146f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<br><br>I&#39;ve mentioned this briefly in another t=
hread, but I=E2=80=99d like to start a dedicated discussion regarding the s=
upport for a &quot;concatenated&quot; value format in helper responses.<br>=
<br>In a recent PR discussion (<a href=3D"https://github.com/squid-cache/sq=
uid/pull/2395#discussion_r3022844826">https://github.com/squid-cache/squid/=
pull/2395#discussion_r3022844826</a>), Alex pointed out issues with using c=
oncatenated formats for passing tag values.<br><div><br></div><div>I propos=
e adding support for a custom delimiter for concatenated values within a si=
ngle KV-pair in the helper output. <br><br>The proposed syntax is:<br>=C2=
=A0 =C2=A0 <font face=3D"monospace">&lt;key&gt;=3D&lt;delimiter&gt;&quot;&l=
t;value1&gt;&lt;delimiter&gt;&lt;value2&gt;...&quot;</font><br><br>Examples=
:<br>=C2=A0 =C2=A0 <font face=3D"monospace">group=3D,&quot;group1,group2,gr=
oup3&quot;</font><br>=C2=A0 =C2=A0 <font face=3D"monospace">clt_con_tag=3D;=
&quot;tag1;tag2;tag3&quot;</font><br><br>Escaping logic:<br>=C2=A0 =C2=A0 I=
f the delimiter appears inside a value within the token, it must be double-=
escaped (\\) by the helper. <br>For example:<br>=C2=A0 =C2=A0 <font face=3D=
"monospace">group=3D,&quot;Staff:accountants\\,lawyers\\,security,Main_Offi=
ce&quot;</font><br>This should produce two separate annotations:<br>=C2=A0 =
=C2=A0<font face=3D"monospace"> group=3DStaff:accountants,lawyers,security<=
/font><br>=C2=A0 =C2=A0<font face=3D"monospace"> group=3DMain_Office</font>=
<br><br>The choice of double escaping is intentional to maintain consistenc=
y with the way <font face=3D"monospace">strwordtok()</font> processes quote=
d values in Squid. <br>This approach ensures that we can preserve the under=
lying logic for handling values while correctly splitting the &quot;glued&q=
uot; tokens.<br><br>Currently, a comma-separated format is often used de fa=
cto, but Squid stores these as a single Entry, requiring the <font face=3D"=
monospace">-m</font> option for annotation checks.<br><br>Proposed Change:<=
br>A minor modification to <font face=3D"monospace">Helper::Reply::parseRes=
ponseKeys()</font>.<br><br>Pros:<br>- More compact data transfer format.<br=
>- Proper data storage on the Squid side (separate values instead of one bl=
ob).<br>- Flexibility for plugin developers via custom delimiters.<br>- Eli=
minates the need for admins to manually manage the <font face=3D"monospace"=
>-m</font> option for these cases.<br><br>I am interested in implementing t=
his and submitting a PR. Do you think this solution is needed and fits the =
project&#39;s direction?</div><div><br></div><div>Kind regards,</div><div>=
=C2=A0 =C2=A0 Ankor.</div></div>

--000000000000894537064ff8146f--

--===============9204576829087824124==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
squid-dev mailing list
[email protected]
https://lists.squid-cache.org/listinfo/squid-dev

--===============9204576829087824124==--