--------------------- PatchSet 5079 Date: 2007/07/18 23:09:14 Author: hno Branch: bug1921 Tag: (none) Log: Use the ServerStateData centralised ICAP glue Members: src/ftp.cc:1.78.2.1->1.78.2.2 Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.78.2.1 retrieving revision 1.78.2.2 diff -u -r1.78.2.1 -r1.78.2.2 --- squid3/src/ftp.cc 18 Jul 2007 10:21:19 -0000 1.78.2.1 +++ squid3/src/ftp.cc 18 Jul 2007 23:09:14 -0000 1.78.2.2 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.78.2.1 2007/07/18 10:21:19 hno Exp $ + * $Id: ftp.cc,v 1.78.2.2 2007/07/18 23:09:14 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -55,12 +55,6 @@ #include "SquidTime.h" #include "URLScheme.h" -#if ICAP_CLIENT -#include "ICAP/ICAPConfig.h" -#include "ICAP/ICAPModXact.h" -extern ICAPConfig TheICAPConfig; -#endif - static const char *const crlf = "\r\n"; static char cbuf[1024]; @@ -1156,17 +1150,6 @@ assert(t != NULL); -#if ICAP_CLIENT - if (virginBodyDestination != NULL) { - // XXX: There are other places where writeReplyBody may overflow! - if ((int)strlen(t) > virginBodyDestination->buf().potentialSpaceSize()) { - debugs(0,0,HERE << "WARNING avoid overwhelming ICAP with data!"); - usable = s - sbuf; - break; - } - } -#endif - writeReplyBody(t, strlen(t)); } @@ -1224,32 +1207,7 @@ if (data.read_pending) return; - int read_sz = data.readBuf->spaceSize(); - -#if ICAP_CLIENT - // TODO: merge with the same code in HttpStateData::maybeReadVirginBody() - if (virginBodyDestination != NULL) { - /* - * BodyPipe buffer has a finite size limit. We - * should not read more data from the network than will fit - * into the pipe buffer or we _lose_ what did not fit if - * the response ends sooner that BodyPipe frees up space: - * There is no code to keep pumping data into the pipe once - * response ends and serverComplete() is called. - * - * If the pipe is totally full, don't register the read handler. - * The BodyPipe will call our noteMoreBodySpaceAvailable() method - * when it has free space again. - */ - int icap_space = virginBodyDestination->buf().potentialSpaceSize(); - - debugs(11,9, "FTP may read up to min(" << icap_space << - ", " << read_sz << ") bytes"); - - if (icap_space < read_sz) - read_sz = icap_space; - } -#endif + int read_sz = replyBodySpace(data.readBuf->spaceSize()); debugs(11,9, HERE << "FTP may read up to " << read_sz << " bytes");