[squid-users] icap example server not working

Alex Rousskov rousskov at measurement-factory.com
Thu Mar 7 03:59:03 UTC 2019


On 3/6/19 3:33 PM, steven wrote:

> after going trough rfc3507 (icap) im not really sure how a icap server
> is supposed to work together with squid,

At the protocol level, an ICAP server works pretty much how RFC 3507
describes it. At the ICAP server software/application level, each server
"works" in its own way, irrelevant to Squid.


> the example on this page: https://github.com/netom/pyicap

> 127.0.0.1 - - [06/b'Mar'/2019 23:22:58] respmod_OPTIONS not found
> 127.0.0.1 - - [06/b'Mar'/2019 23:22:58] code 404, message b'Not Found'

I know nothing about that ICAP framework, but you probably need to
follow its README directions and define the respmod_OPTIONS method
(among other things):

> You can use a framework by importing stuff from the pyicap package,
> extending the protocol handler class and starting the server, passing
> your handler to it: ...

In other words, that specific ICAP code is not a ready-to-use ICAP
server but a _framework_ for building an ICAP server (that does what
_you_ want it to do).

If you need an ICAP server to do X, then you should either find an
existing ICAP server that already does X or build a new ICAP server that
does X. The latter should be accomplished either by using an existing
ICAP library/framework (like the one you found above) or by writing a
loadable module/plugin/adapter (that does X) for an existing ICAP server
that accepts such adapters.

Squid wiki has a bit more info about ICAP:

* https://wiki.squid-cache.org/SquidFaq/ContentAdaptation#ICAP
* https://wiki.squid-cache.org/Features/ICAP

The first page also discusses (and compares) various ICAP alternatives.


HTH,

Alex.


> icap_service service_resp respmod_precache bypass=0
> icap://127.0.0.1:1344/echo
> adaptation_access service_resp allow all
> 
> ----------------------------------------
> Exception happened during processing of request from ('127.0.0.1', 46458)
> Traceback (most recent call last):
>   File "/usr/lib/python3.7/socketserver.py", line 650, in
> process_request_thread
>     self.finish_request(request, client_address)
>   File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
>     self.handle()
>   File
> "/home/julius/code/python/icap/venv/lib/python3.7/site-packages/pyicap.py",
> line 443, in handle
>     self.handle_one_request()
>   File
> "/home/julius/code/python/icap/venv/lib/python3.7/site-packages/pyicap.py",
> line 494, in handle_one_request
>     method()
>   File "icaptest.py", line 22, in echo_OPTIONS
>     self.send_headers(False)
>   File
> "/home/julius/code/python/icap/venv/lib/python3.7/site-packages/pyicap.py",
> line 326, in send_headers
>     icap_header_str += k + b': ' + v + b'\r\n'
> TypeError: can only concatenate str (not "bytes") to str
> ----------------------------------------
> 
> 
> 
> 
> squid config:
> 
> icap_enable on
> 
> icap_preview_enable off
> icap_send_client_ip on
> icap_send_client_username on
> icap_service service_req reqmod_precache bypass=1
> icap://127.0.0.1:1344/respmod
> adaptation_access service_req allow all
> #icap_service service_resp respmod_precache bypass=0
> icap://127.0.0.1:1344/response
> #adaptation_access service_resp allow all
> 
> 
> 
> 
> why is this simple example not working?
> 
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-users



More information about the squid-users mailing list