On Tue, 2006-12-05 at 16:24 +0100, Gernot Tenchio wrote:

> Sometimes squid does not send a preview to the icap server even if
> requested. It seems to happen if squid doesn't know how large the
> response would be. Is this intended?

As far as I can see, if the expected body size is unknown, Squid will
send a zero-size preview. A comment in the code questions that logic.

I do not know why Squid sets preview size to zero in that case; it could
be an if-statement condition bug or just a leftover from earlier, less
capable code.

If you are willing to experiment, please try the attached patch. The
patch removes the code that sets preview size to zero when the body size
is not known. Please let me know whether the patch works for you.

Thank you,

Alex.

Index: src/ICAP/ICAPModXact.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/ICAP/ICAPModXact.cc,v
retrieving revision 1.1.2.17
diff -u -u -r1.1.2.17 ICAPModXact.cc
--- src/ICAP/ICAPModXact.cc	25 Oct 2006 04:57:03 -0000	1.1.2.17
+++ src/ICAP/ICAPModXact.cc	6 Dec 2006 15:12:22 -0000
@@ -1067,10 +1067,11 @@
     // cannot preview more than we can backup
     size_t ad = XMIN(wantedSize, TheBackupLimit);
 
-    if (virginBody.expected() && virginBody.knownSize())
-        ad = XMIN(ad, virginBody.size()); // not more than we have
+    if (!virginBody.expected())
+        ad = 0; // nothing to preview but headers
     else
-        ad = 0; // questionable optimization?
+    if (virginBody.knownSize())
+        ad = XMIN(ad, virginBody.size()); // not more than we have
 
     debugs(93, 5, "ICAPModXact should offer " << ad << "-byte preview " <<
            "(service wanted " << wantedSize << ")");

Reply via email to