[squid-users] Sharing info from eCAP adapter with other adapters

Moti Berger moberger at metanetworks.com
Wed Jul 14 21:11:42 UTC 2021


Hi

I have an env with Squid 4 with several ICAPs.
In this env, I set in squid.conf the following:

adaptation_masterx_shared_names X-My-Header
>

and I add an ICAP header X-My-Header with some data in one ICAP and next
ICAPs can use it (I also see it in tcpdump output).

Now I'm writing an eCAP and I did the following (for testing):

static const libecap::Name myHeader("X-My-Header",
> libecap::Name::NextId());

const libecap::Area Adapter::Xaction::option(const libecap::Name &name)
> const
> {
>
>     if (name == myHeader) {

        std::string t = "popo";

        return libecap::Area(t.data(), t.size());
>
    }

    return libecap::Area();
> }
>
>
> void Adapter::Xaction::visitEachOption(libecap::NamedValueVisitor
> &visitor) const
> {
>
>     std::string t = "popo";
>
>     visitor.visit(myHeader, libecap::Area(t.data(), t.size()));
>

}


 It is much like the clamAV eCAP example.
What I see in tcpdump output is the following:

X.....qZREQMOD icap://my.proxy:1234/request ICAP/1.0
> Host: my.proxy:1234
> Date: Wed, 14 Jul 2021 20:37:33 GMT
> X-My-Header: .
> Encapsulated: req-hdr=0, null-body=427
> Preview: 0
> Allow: 204


Meaning, it indeed added the X-My-Header as ICAP header for the benefit of
the ICAP server on the chain but it seems the value is just a dot.
What am I doing wrong?
BTW, I'm struggling to find a decent eCAP interface documentation. Can you
please help me understand what is the difference between 'option' and
'visitEachOption' methods?

Thanks,
Moti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20210715/b923b8a2/attachment.htm>


More information about the squid-users mailing list