--------------------- PatchSet 1521 Date: 2005/08/17 23:49:25 Author: dwsquid Branch: squid3-icap Tag: (none) Log: misc ICAP related changes/progress Members: src/ICAPAnchor.cc:1.1.2.2->1.1.2.3 src/ICAPAnchor.h:1.1.2.2->1.1.2.3 src/MsgPipeData.h:1.1.2.3->1.1.2.4 src/http.cc:1.49.2.1->1.49.2.2 Index: squid3/src/ICAPAnchor.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPAnchor.cc,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid3/src/ICAPAnchor.cc 17 Aug 2005 22:01:26 -0000 1.1.2.2 +++ squid3/src/ICAPAnchor.cc 17 Aug 2005 23:49:25 -0000 1.1.2.3 @@ -23,7 +23,7 @@ virgin->data = new MsgPipeData; virgin->data->cause = request; virgin->data->header = reply; - virgin->data->body = new mem_hdr; + virgin->data->body = new MemBuf; adapted = new MsgPipe; adapted->sink = this; @@ -36,51 +36,64 @@ } void ICAPAnchor::sendMoreData(StoreIOBuffer buf) { + debug(0,0)("ICAPAnchor::sendMoreData() called\n"); + buf.dump(); +#if MSG_PIPE_USES_MEM_HDR + virgin->data->body->write(buf); +#else + memBufAppend(virgin->data->body, buf.data, buf.length); +#endif virgin->sendSourceProgress(); } +// HttpStateData says we have the entire HTTP message +void ICAPAnchor::doneSending() { + debug(0,0)("ICAPAnchor::doneSending() called\n"); +} + // HttpStateData tells us to abort void ICAPAnchor::ownerAbort() { + debug(0,0)("ICAPAnchor::ownerAbort() called\n"); stop(notifyIcap); } // ICAP client needs more virgin response data void ICAPAnchor::noteSinkNeed(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSinkNeed called\n"); + debug(0,0)("ICAPAnchor::noteSinkNeed() called\n"); //1) tell HttpStateData to resume reading (in case it has stopped due to full buffers, etc.) //2) check that HttpStateData is reading (or we will get stuck w/o progress) } // ICAP client aborting void ICAPAnchor::noteSinkAbort(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSinkNeed called\n"); + debug(0,0)("ICAPAnchor::noteSinkNeed() called\n"); stop(notifyOwner); } // ICAP client starts sending adapted response // ICAP client has received new HTTP headers (if any) at this point void ICAPAnchor::noteSourceStart(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSourceStart called\n"); + debug(0,0)("ICAPAnchor::noteSourceStart() called\n"); //tell HttpStateData to prepare the response store noteSourceProgress(p); } // ICAP client sends more data void ICAPAnchor::noteSourceProgress(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSourceProgress called\n"); + debug(0,0)("ICAPAnchor::noteSourceProgress() called\n"); //tell HttpStateData to store a fresh portion of the adapted response } // ICAP client is done sending adapted response void ICAPAnchor::noteSourceFinish(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSourceFinish called\n"); + debug(0,0)("ICAPAnchor::noteSourceFinish() called\n"); //tell HttpStateData that we expect no more response data stop(notifyNone); } // ICAP client is aborting void ICAPAnchor::noteSourceAbort(MsgPipe *p) { - debug(0,0)("ICAPAnchor::noteSourceAbort called\n"); + debug(0,0)("ICAPAnchor::noteSourceAbort() called\n"); stop(notifyOwner); } Index: squid3/src/ICAPAnchor.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPAnchor.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid3/src/ICAPAnchor.h 17 Aug 2005 22:01:26 -0000 1.1.2.2 +++ squid3/src/ICAPAnchor.h 17 Aug 2005 23:49:25 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ICAPAnchor.h,v 1.1.2.2 2005/08/17 22:01:26 dwsquid Exp $ + * $Id: ICAPAnchor.h,v 1.1.2.3 2005/08/17 23:49:25 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -56,6 +56,7 @@ // synchronous calls called by HttpStateData void startRespMod(HttpStateData *anHttpState, HttpRequest *request, HttpReply *reply); void sendMoreData(StoreIOBuffer buf); + void doneSending(); void ownerAbort(); // pipe source methods; called by ICAP while receiving the virgin message Index: squid3/src/MsgPipeData.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/MsgPipeData.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid3/src/MsgPipeData.h 17 Aug 2005 22:01:26 -0000 1.1.2.3 +++ squid3/src/MsgPipeData.h 17 Aug 2005 23:49:25 -0000 1.1.2.4 @@ -1,6 +1,6 @@ /* - * $Id: MsgPipeData.h,v 1.1.2.3 2005/08/17 22:01:26 dwsquid Exp $ + * $Id: MsgPipeData.h,v 1.1.2.4 2005/08/17 23:49:25 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,7 +36,11 @@ #include "HttpReply.h" +#if MSG_PIPE_USES_MEM_HDR class mem_hdr; +#else +class MemBuf; +#endif // MsgPipeData contains information about the HTTP message being sent // from the pipe source to the sink. Since the entire message body may be @@ -53,7 +57,11 @@ public: typedef HttpReply Header; +#if MSG_PIPE_USES_MEM_HDR typedef mem_hdr Body; +#else + typedef MemBuf Body; +#endif // message being piped Header *header; // parsed HTTP headers Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.49.2.1 retrieving revision 1.49.2.2 diff -u -r1.49.2.1 -r1.49.2.2 --- squid3/src/http.cc 17 Aug 2005 22:01:26 -0000 1.49.2.1 +++ squid3/src/http.cc 17 Aug 2005 23:49:25 -0000 1.49.2.2 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.49.2.1 2005/08/17 22:01:26 dwsquid Exp $ + * $Id: http.cc,v 1.49.2.2 2005/08/17 23:49:25 dwsquid Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1136,8 +1136,6 @@ tempBuffer.offset = currentOffset; currentOffset += tempBuffer.length; #if ICAP_CLIENT - debug(0,0)("processReplyData: tempBuffer@%d:\n", __LINE__); - tempBuffer.dump(); icap->sendMoreData (tempBuffer); #else entry->write (tempBuffer); @@ -1151,8 +1149,6 @@ tempBuffer.offset = currentOffset; currentOffset += len; #if ICAP_CLIENT - debug(0,0)("processReplyData: tempBuffer@%d:\n", __LINE__); - tempBuffer.dump(); icap->sendMoreData (tempBuffer); #else entry->write(tempBuffer); @@ -1957,6 +1953,10 @@ CBDATA_INIT_TYPE(ICAPAnchor); icap = cbdataAlloc(ICAPAnchor); (void)cbdataReference(icap); + + /* XXX */ + storeUnlockObject(entry); + entry = NULL; return 0; } #endif