Re: Squid 3 HEAD - ICAP Modifications

2006-12-06 Thread Alex Rousskov
On Mon, 2006-12-04 at 12:57 +0100, Axel Westerhold wrote:
 Hi everyone,
 
 Second try this time hopefully complete.
 
 This is again patched against Squid 3 HEAD and includes 4 changes I would
 like to have when working with webwasher/squid systems.
 
 
 A.) ICAPServiceRep::TheSessionFailureLimit set through squid.conf
 B.) ICAPServiceRep delay for a down service set through squid.conf
 C.) Instead of hardcoding the Header used to transfer the username being
 able to set the used one through squid.conf
 D.) When using X-Authenticated-User in C I need the username to be base64
 encoded so I added another option to turn on encoding if needed.

I will work on adding these changes to the squid3-icap branch.

Thank you,

Alex.




Re: squid3 icap preview

2006-12-06 Thread Alex Rousskov
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 -	1.1.2.17
+++ src/ICAP/ICAPModXact.cc	6 Dec 2006 15:12:22 -
@@ -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  ));


WCCPv2 patch to fix crashing during mask assignment.

2006-12-06 Thread Adrian Chadd
I've had a few people who have commented on the mask assignment code in 
squid-2.6
causing squid to crash.

The code in 2.6 almost DTRT - that loop is just being called once too many 
times.
I've shifted it around slightly to make it work again. No idea if/when it broke.

I'll commit this patch to fix the current behaviour to not crash squid unless
anyone has any objections.



Adrian

--- wccp2.c.200612062006-12-06 18:02:33.0 -0500
+++ wccp2.c 2006-12-06 18:27:42.0 -0500
@@ -1478,6 +1478,10 @@
value = 0;
for (valuecounter = 0; valuecounter  64; valuecounter++) {
value_element = (struct wccp2_value_element_t *) 
wccp_packet[offset];
+   /* Update the value according the the correct formula */
+   for (; (value  0x1741) != value; value++) {
+   assert(value = 0x1741);
+   }
 
if ((service_flags  WCCP2_SERVICE_SRC_IP_HASH) || 
(service_flags  WCCP2_SERVICE_SRC_IP_ALT_HASH)) {
value_element-source_ip_value = htonl(value);
@@ -1504,11 +1508,7 @@
}
value_element-cache_ip = cache_list_ptr-cache_ip;
offset += sizeof(struct wccp2_value_element_t);
-
-   /* Update the value according the the correct formula */
-   for (value++; (value  0x1741) != value; value++) {
-   assert(value = 0x1741);
-   }
+   value++;
 
/* Assign the next value to the next cache */
if ((cache_list_ptr-next)  (cache_list_ptr-next-next))

-- 
- Xenion - http://www.xenion.com.au/ - Hosting and Commercial Squid Support -