Hi, Could someone add the 3 attached patches to the squid icap client?
Here's a description of what they fix... closebeforesendfix.patch ======================== I noticed that sometimes requests to the site http://www.retail-week.com would fail to load a certain component and the page wouldn't finish loading until a timeout occurred. I found that this was due to the origin server closing the connection without sending any data and squid wasn't handling this cleanly. This patch frees the icap connection immediately so that we don't have to wait for the timeout. http0.9fix.patch ================ I noticed that requests to the site http://in.sports.yahoo.com/sportz/homeimages/rightheader_quiz.gif would fail to load. This was because the origin server does not add any http headers to the response (http 0.9) and the squid icap code wasn't handling it well. This patch fixes the problem. squidgrowthfix.patch ==================== I noticed that if a large file was being downloaded through the squid icap code then this could cause squid to grow. The growth would occur if the browser had prompted the user asking them to open or save the file but the user had not responded - the file would be stored in mem_nodes. The memory that was used would often not be returned to the system because of memory fragmentation making the problem even worse. This patch adds to commSetDefer() calls that will avoid the growth by deferring reads from both the origin server and the icap server until the http client is ready to receive the data. Thanks, Graeme This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
diff -urN squid-2.5.STABLE12/src/icap_respmod.c squid-2.5.STABLE12-closebeforesendfix/src/icap_respmod.c --- squid-2.5.STABLE12/src/icap_respmod.c 2006-01-05 16:26:37.000000000 +0000 +++ squid-2.5.STABLE12-closebeforesendfix/src/icap_respmod.c 2006-01-05 16:52:42.000000000 +0000 @@ -252,6 +252,16 @@ #endif if (icap->sc == 0) { + // http connection has been closed without sending us anything + if(len == 0 && theEnd == 1) { + ErrorState *err; + err = errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY); + err->request = requestLink(icap->request); + errorAppendEntry(icap->respmod.entry, err); + comm_close(icap->icap_fd); + return; + } + /* No data sent yet. Start with headers */ if ((icap->sc = buildRespModHeader(&mb, icap, buf, len, theEnd)) > 0) { buf += icap->sc;
diff -urN squid-2.5.STABLE12/src/icap_respmod.c squid-2.5.STABLE12-http0.9fix/src/icap_respmod.c --- squid-2.5.STABLE12/src/icap_respmod.c 2006-01-05 16:26:37.000000000 +0000 +++ squid-2.5.STABLE12-http0.9fix/src/icap_respmod.c 2006-01-05 16:51:08.000000000 +0000 @@ -104,6 +104,9 @@ consumed = -1; o2 = -1; memBufDefInit(&mb_hdr); + httpBuildRequestPrefix(icap->request, icap->request, + icap->respmod.entry, &mb_hdr, icap->http_flags); + o3 = mb_hdr.size; } else { hlen = headersEnd(icap->respmod.req_hdr_copy.buf, @@ -132,12 +135,12 @@ httpBuildRequestPrefix(icap->request, icap->request, icap->respmod.entry, &mb_hdr, icap->http_flags); o2 = mb_hdr.size; - } - /* Copy response header - Append to request header mbuffer */ - memBufAppend(&mb_hdr, - icap->respmod.req_hdr_copy.buf, icap->respmod.req_hdr_copy.size); - o3 = mb_hdr.size; + /* Copy response header - Append to request header mbuffer */ + memBufAppend(&mb_hdr, + icap->respmod.req_hdr_copy.buf, icap->respmod.req_hdr_copy.size); + o3 = mb_hdr.size; + } service = icap->current_service; assert(service);
diff -urN squid-2.5.STABLE12/src/http.c squid-2.5.STABLE12-squidgrowthfix/src/http.c --- squid-2.5.STABLE12/src/http.c 2006-01-05 16:26:37.000000000 +0000 +++ squid-2.5.STABLE12-squidgrowthfix/src/http.c 2006-01-05 16:53:30.000000000 +0000 @@ -629,6 +629,10 @@ commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); return; } + + if(icap->flags.no_content == 1) { + commSetDefer(fd, fwdCheckDeferRead, icap->respmod.entry); + } } #endif diff -urN squid-2.5.STABLE12/src/icap_respmod.c squid-2.5.STABLE12-squidgrowthfix/src/icap_respmod.c --- squid-2.5.STABLE12/src/icap_respmod.c 2006-01-05 16:26:37.000000000 +0000 +++ squid-2.5.STABLE12-squidgrowthfix/src/icap_respmod.c 2006-01-05 16:53:59.000000000 +0000 @@ -627,6 +627,7 @@ commSetSelect(fd, COMM_SELECT_READ, icapRespModReadReply, icap, 0); #if 1 commSetTimeout(fd, Config.Timeout.read, icapReadTimeout, icap); + commSetDefer(fd, fwdCheckDeferRead, icap->respmod.entry); #else if (icap->flags.wait_for_preview_reply || icap->flags.http_server_eof) { /*