--------------------- PatchSet 1591 Date: 2005/08/24 19:08:44 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Use min and max buffer sizes for ICAP message pipes as recommended by ICAPClient. - Make sure we do not read if body buffer is full. Use newly added MemBuf::hasPotentialSpace(). Members: src/ICAPXaction.cc:1.1.2.7->1.1.2.8 Index: squid3/src/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.cc,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid3/src/ICAPXaction.cc 24 Aug 2005 17:37:08 -0000 1.1.2.7 +++ squid3/src/ICAPXaction.cc 24 Aug 2005 19:08:44 -0000 1.1.2.8 @@ -119,7 +119,7 @@ adapted->data = new MsgPipeData; adapted->data->header = httpReplyCreate(); // who is deleting? refcount? adapted->data->body = new MemBuf; // XXX: make body a non-pointer? - memBufInit(adapted->data->body, ICAPMsgPipeBufSize, 1<<20); + memBufInit(adapted->data->body, ICAPMsgPipeBufSizeMin, ICAPMsgPipeBufSizeMax); // headers are initialized when we parse them // writing end @@ -302,6 +302,10 @@ void ICAPXaction::readMore() { if (state.isReading || state.doneReading) return; + + // do not fill readBuf if we have no space to store the result + if (!adapted->data->body->hasPotentialSpace()) + return; // we use the same buffer for headers and body and then consume headers if (readBuf.hasSpace()) { @@ -366,7 +370,7 @@ if (state.parsingHeaders()) // need more data Must(!state.doneReading); else - adapted->sendSourceStart(); + adapted->sendSourceStart(); } void ICAPXaction::parseHeader(HttpReply *header) {