test ICAP server

Robin Wood <[email protected]>
Newsgroups gmane.comp.web.squid.general
Message-ID <CALmccy71n_j=P3xHOJHwfqPeZ=pM+32ZhoSiqHHHRKPgYU9BqA@mail.gmail.com>
Hi
I want to write my own ICAP server, but all the sample code I've found is
failing, the majority with this error from squidclient:

squidclient -h 192.168.0.7 -p 1344 icap://192.168.0.7:1344/request_mod
ICAP/1.0 400 Bad Request

And this error when accessed through Squid itself:

ICAP protocol error.

The system returned: [No Error]

This means that some aspect of the ICAP communication failed.

I've got this in my squid.conf:

# Enable ICAP for request and response modification
icap_enable on
icap_service service_req reqmod_precache icap://192.168.0.7:1344/request_mod
icap_service service_resp respmod_precache icap://
192.168.0.7:1344/response_mod

# ICAP adaptation rules
adaptation_access service_req allow all
adaptation_access service_resp allow all

And I've tried running both Python and Ruby servers taken from various
places. A lot are logging that they've received and replied to requests:

Received request: OPTIONS icap://192.168.0.7:1344/request_mod ICAP/1.0
Responded to OPTIONS request

The servers are all listening, I've checked that:

$ ss -antp | grep 1344
LISTEN     0      4096                       0.0.0.0:1344
 0.0.0.0:*     users:(("ruby",pid=563029,fd=5))

The closest I've got is this one:

https://gist.github.com/digininja/a98b3567e0aeb218d37cdd337bb12f34

It seems to be working as it sees the headers and says it has returned data:

Received request: REQMOD icap://192.168.0.7:1344/request_mod ICAP/1.0
Original Headers:
Host: 192.168.0.7:1344
Date: Fri, 07 Feb 2025 10:10:30 GMT
Encapsulated: req-hdr=0, null-body=91
Preview: 0
Allow: 204, trailers
Modified request sent back

But I still get errors.

What could be wrong?

Does someone have some example server code they know works that I can test
to help debug it?

Robin

_______________________________________________
squid-users mailing list
[email protected]
https://lists.squid-cache.org/listinfo/squid-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.