uatuko / bitz-server

An ICAP server implementation in C++
27 stars 4 forks source link

How to make ICAP Preview work #17

Open gr3m1in opened 5 years ago

gr3m1in commented 5 years ago

Hi,

I'm trying to set up an ICAP preview option, but the requests always go to modify() method and never hit preview(). Squid configuration contains

icap_preview_enable on
icap_preview_size 4096

and I've even tried to hardcode preview header to bitz-server's OPTIONS response, as RFC describes

   -- Preview:

      The number of bytes to be sent by the ICAP client during a
      preview.  This header MAY be included in the OPTIONS response.

      For example:
      Preview: 1024

using the following patch

--- a/src/bitz/options_request_handler.cpp      2019-04-24 15:12:20.809422286 +0200
+++ b/src/bitz/options_request_handler.cpp      2019-04-24 15:12:51.316184238 +0200
@@ -38,6 +38,7 @@
                header->attach( "Methods", _methods.at( 0 ) );
                header->attach( "Options-TTL", "3600" );
                header->attach( "Allow", "204" );
+               header->attach( "Preview", "4096" );

                response = new icap::Response( header );
                return response;

with no luck.

Am I doing something wrong or is there something else must be done to make preview working?

Thanks in advance.

Kind regards, gr3m1in