--------------------- PatchSet 6031 Date: 2003/11/13 23:39:39 Author: dwsquid Branch: icap-2_5 Tag: (none) Log: fixed some bugs with ICAP 204 replies. Need to zero buffer size after we consume them. Members: src/icap_respmod.c:1.1.2.19->1.1.2.20 Index: squid/src/icap_respmod.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap_respmod.c,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -u -r1.1.2.19 -r1.1.2.20 --- squid/src/icap_respmod.c 7 Nov 2003 05:52:53 -0000 1.1.2.19 +++ squid/src/icap_respmod.c 13 Nov 2003 23:39:39 -0000 1.1.2.20 @@ -1,5 +1,5 @@ /* - * $Id: icap_respmod.c,v 1.1.2.19 2003/11/07 05:52:53 dwsquid Exp $ + * $Id: icap_respmod.c,v 1.1.2.20 2003/11/13 23:39:39 dwsquid Exp $ * * DEBUG: section 81 Internet Content Adaptation Protocol (ICAP) Client * AUTHOR: Geetha Manjunath, Hewlett Packard Company @@ -160,9 +160,21 @@ * ICAP server said there are no modifications to make, so * just append this data to the StoreEntry */ - memBufAppend(&icap->chunk_buf, - icap->respmod.resp_copy.buf, - icap->respmod.resp_copy.size); + if (icap->respmod.resp_copy.size) { + /* + * first copy the data that we already sent to the ICAP server + */ + memBufAppend(&icap->chunk_buf, + icap->respmod.resp_copy.buf, + icap->respmod.resp_copy.size); + icap->respmod.resp_copy.size = 0; + } + if (len) { + /* + * also copy any new data from the HTTP side + */ + memBufAppend(&icap->chunk_buf, buf, len); + } if (icapReadReply2(icap) < 0) return 0; return 1; @@ -405,11 +417,12 @@ /* * copy the response already written to the ICAP server */ - debug(81, 3) ("copying %d bytes from resp_copy to entry\n", + debug(81, 3) ("copying %d bytes from resp_copy to chunk_buf\n", icap->respmod.resp_copy.size); memBufAppend(&icap->chunk_buf, icap->respmod.resp_copy.buf, icap->respmod.resp_copy.size); + icap->respmod.resp_copy.size = 0; if (icapReadReply2(icap) < 0) comm_close(fd); /* @@ -826,7 +839,10 @@ debug(81, 3) ("%s:%d: flags.no_content=%d\n", __FILE__, __LINE__, icap->flags.no_content); if (icap->flags.no_content) { /* data from http.c is not chunked */ + debug(81, 3) ("copying %d bytes from chunk_buf to entry\n", + icap->chunk_buf.size); storeAppend(entry, icap->chunk_buf.buf, icap->chunk_buf.size); + icap->chunk_buf.size = 0; } else if (2 == icapHttpReplyHdrState(icap)) { if (icap->chunk_buf.size) icapParseChunkedBody(icap, storeAppend, entry);