--------------------- PatchSet 6035 Date: 2003/11/14 02:09:21 Author: dwsquid Branch: icap-2_5 Tag: (none) Log: Need to make sure that icapReadReply3() is called for ICAP 204 responses, otherwise the connection may remain open and generate a timeout. icapSendRespMod()'s return value is always ignored, so it can be void. Members: src/icap_respmod.c:1.1.2.23->1.1.2.24 src/protos.h:1.41.6.13.2.18->1.41.6.13.2.19 Index: squid/src/icap_respmod.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap_respmod.c,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -u -r1.1.2.23 -r1.1.2.24 --- squid/src/icap_respmod.c 14 Nov 2003 01:34:36 -0000 1.1.2.23 +++ squid/src/icap_respmod.c 14 Nov 2003 02:09:22 -0000 1.1.2.24 @@ -1,5 +1,5 @@ /* - * $Id: icap_respmod.c,v 1.1.2.23 2003/11/14 01:34:36 dwsquid Exp $ + * $Id: icap_respmod.c,v 1.1.2.24 2003/11/14 02:09:22 dwsquid Exp $ * * DEBUG: section 81 Internet Content Adaptation Protocol (ICAP) Client * AUTHOR: Geetha Manjunath, Hewlett Packard Company @@ -144,7 +144,7 @@ } -int +void icapSendRespMod(IcapStateData * icap, void *buf, int len, int theEnd) { MemBuf mb; @@ -175,9 +175,8 @@ */ memBufAppend(&icap->chunk_buf, buf, len); } - if (icapReadReply2(icap) < 0) - return 0; - return 1; + (void) icapReadReply2(icap); + return; } if (theEnd) { if (icap->respmod.res_body_sz) @@ -195,11 +194,11 @@ debug(81, 3) ("icapSendRespMod: oops, write_pending=1\n"); assert(theEnd); assert(len == 0); - return 0; + return; } if (!cbdataValid(icap)) { debug(81, 3) ("icapSendRespMod: failed to establish connection?\n"); - return 0; + return; } memBufDefInit(&mb); @@ -220,7 +219,7 @@ if (0 == icap->sc) { /* check again; bail if we're not ready to send ICAP/HTTP hdrs */ debug(81, 5) ("icapSendRespMod: dont have full HTTP response hdrs\n"); - return 0; + return; } #if ICAP_PREVIEW if (preview_size < 0) /* preview feature off */ @@ -286,7 +285,7 @@ commSetSelect(icap->http_fd, COMM_SELECT_READ, httpReadReply, httpState, 0); } - return 0; + return; } else #endif { @@ -325,7 +324,7 @@ icap->flags.write_pending = 1; comm_write_mbuf(icap->icap_fd, mb, icapSendRespModDone, icap); } - return 1; + return; } static void @@ -778,6 +777,7 @@ { StoreEntry *entry = icap->respmod.entry; const request_t *request = icap->request; + debug(81,3)("icapReadReply2\n"); if (icap->chunk_buf.size == 0 && entry->mem_obj->inmem_hi == 0) { ErrorState *err; err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE); @@ -788,12 +788,12 @@ return -1; } if (icap->chunk_buf.size == 0) { - /* Connection closed; retrieval done. */ + /* Retrieval done. */ if (icapHttpReplyHdrState(icap) < 2) icapProcessHttpReplyHeader(icap, icap->chunk_buf.buf, icap->chunk_buf.size); - storeComplete(entry); icap->flags.http_server_eof = 1; - return -1; + icapReadReply3(icap); + return 0; } if (icapHttpReplyHdrState(icap) == 0) { int expect = icapExpectedHttpReplyHdrSize(icap); @@ -861,6 +861,7 @@ { StoreEntry *entry = icap->respmod.entry; int fd = icap->icap_fd; + debug(81,3)("icapReadReply3\n"); if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* * the above storeAppend() call could ABORT this entry, Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.41.6.13.2.18 retrieving revision 1.41.6.13.2.19 diff -u -r1.41.6.13.2.18 -r1.41.6.13.2.19 --- squid/src/protos.h 4 Nov 2003 18:22:33 -0000 1.41.6.13.2.18 +++ squid/src/protos.h 14 Nov 2003 02:09:21 -0000 1.41.6.13.2.19 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.41.6.13.2.18 2003/11/04 18:22:33 dwsquid Exp $ + * $Id: protos.h,v 1.41.6.13.2.19 2003/11/14 02:09:21 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1374,7 +1374,7 @@ * icap_respmod.c */ IcapStateData *icapRespModStart(icap_service_t, request_t *, StoreEntry *, http_state_flags); -int icapSendRespMod(IcapStateData *, void *, int, int); +void icapSendRespMod(IcapStateData *, void *, int, int); /* * icap_reqmod.c