--------------------- PatchSet 10319 Date: 2007/12/27 05:12:20 Author: adri Branch: s27_adri Tag: (none) Log: Fix memBufGrow() to be more accepting; and don't deallocate the membuf if we're going to reuse it straight away (in http.c) Members: src/MemBuf.c:1.11.26.1->1.11.26.2 src/http.c:1.63.2.3.4.20->1.63.2.3.4.21 Index: squid/src/MemBuf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/MemBuf.c,v retrieving revision 1.11.26.1 retrieving revision 1.11.26.2 diff -u -r1.11.26.1 -r1.11.26.2 --- squid/src/MemBuf.c 26 Dec 2007 16:02:50 -0000 1.11.26.1 +++ squid/src/MemBuf.c 27 Dec 2007 05:12:20 -0000 1.11.26.2 @@ -1,6 +1,6 @@ /* - * $Id: MemBuf.c,v 1.11.26.1 2007/12/26 16:02:50 adri Exp $ + * $Id: MemBuf.c,v 1.11.26.2 2007/12/27 05:12:20 adri Exp $ * * DEBUG: section 59 auto-growing Memory Buffer with printf * AUTHOR: Alex Rousskov @@ -172,7 +172,8 @@ } else { assert(!mb->stolen); /* not frozen */ /* reset */ - memset(mb->buf, 0, mb->capacity); + //memset(mb->buf, 0, mb->capacity); + mb->buf[0] = '\0'; mb->size = 0; } } @@ -321,6 +322,9 @@ assert(mb); assert(!mb->stolen); + if (mb->capacity >= min_cap) + return; + assert(mb->capacity < min_cap); /* determine next capacity */ Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.63.2.3.4.20 retrieving revision 1.63.2.3.4.21 diff -u -r1.63.2.3.4.20 -r1.63.2.3.4.21 --- squid/src/http.c 27 Dec 2007 05:01:45 -0000 1.63.2.3.4.20 +++ squid/src/http.c 27 Dec 2007 05:12:20 -0000 1.63.2.3.4.21 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.63.2.3.4.20 2007/12/27 05:01:45 adri Exp $ + * $Id: http.c,v 1.63.2.3.4.21 2007/12/27 05:12:20 adri Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1005,7 +1005,7 @@ assert(! memBufIsNull(&httpState->reply_hdr)); httpAppendBody(httpState, httpState->reply_hdr.buf + done, httpState->reply_hdr.size - done, buffer_filled); if (! memBufIsNull(&httpState->reply_hdr)) - memBufClean(&httpState->reply_hdr); + memBufReset(&httpState->reply_hdr); return; } }