---------------------
PatchSet 2329 
Date: 2001/05/13 14:34:42
Author: rbcollins
Branch: newhttp
Tag: (none) 
Log:
fixup from merge, and addition of refcounted allocator

Members: 
	src/Makefile.in:1.1.1.3.8.8.2.10.2.4->1.1.1.3.8.8.2.10.2.5 
	src/acl.c:1.1.1.3.8.8.4.10.2.1->1.1.1.3.8.8.4.10.2.2 
	src/cbdata.c:1.1.1.2.12.4.4.2.2.2->1.1.1.2.12.4.4.2.2.3 
	src/comm.c:1.1.1.3.8.7.4.3.2.6->1.1.1.3.8.7.4.3.2.7 
	src/defines.h:1.1.1.3.8.7.2.8.2.5->1.1.1.3.8.7.2.8.2.6 
	src/enums.h:1.1.1.3.8.8.4.7.2.2->1.1.1.3.8.8.4.7.2.3 
	src/iobuf.c:1.1.2.2->1.1.2.3 
	src/main.c:1.1.1.3.4.1.4.10.4.7.2.2->1.1.1.3.4.1.4.10.4.7.2.3 
	src/protos.h:1.1.1.3.8.11.2.20.2.8->1.1.1.3.8.11.2.20.2.9 
	src/rcdata.c:1.1->1.1.2.1 
	src/transfer-encoding.c:1.1.2.1.2.8.2.1->1.1.2.1.2.8.2.2 
	src/modules/http_client/client_side.c:1.1.2.4->1.1.2.5 

Index: squid/src/Makefile.in
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/Attic/Makefile.in,v
retrieving revision 1.1.1.3.8.8.2.10.2.4
retrieving revision 1.1.1.3.8.8.2.10.2.5
diff -u -r1.1.1.3.8.8.2.10.2.4 -r1.1.1.3.8.8.2.10.2.5
--- squid/src/Makefile.in	13 May 2001 13:07:08 -0000	1.1.1.3.8.8.2.10.2.4
+++ squid/src/Makefile.in	13 May 2001 14:34:42 -0000	1.1.1.3.8.8.2.10.2.5
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.1.1.3.8.8.2.10.2.4 2001/05/13 13:07:08 rbcollins Exp $
+#  $Id: Makefile.in,v 1.1.1.3.8.8.2.10.2.5 2001/05/13 14:34:42 rbcollins Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -158,6 +158,7 @@
 		pconn.o \
 		peer_digest.o \
 		peer_select.o \
+		rcdata.o \
 		redirect.o \
 		referer.o \
 		refresh.o \
Index: squid/src/acl.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/acl.c,v
retrieving revision 1.1.1.3.8.8.4.10.2.1
retrieving revision 1.1.1.3.8.8.4.10.2.2
diff -u -r1.1.1.3.8.8.4.10.2.1 -r1.1.1.3.8.8.4.10.2.2
--- squid/src/acl.c	13 May 2001 13:07:08 -0000	1.1.1.3.8.8.4.10.2.1
+++ squid/src/acl.c	13 May 2001 14:34:42 -0000	1.1.1.3.8.8.4.10.2.2
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.c,v 1.1.1.3.8.8.4.10.2.1 2001/05/13 13:07:08 rbcollins Exp $
+ * $Id: acl.c,v 1.1.1.3.8.8.4.10.2.2 2001/05/13 14:34:42 rbcollins Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -688,15 +688,6 @@
 }
 
 static void
-aclParseWordList(parserNameNode *parserName, void *curlist)
-{
-    char *t = NULL;
-    while ((t = strtokFile()))
-	wordlistAdd(curlist, t);
-}
-#endif
-
-static void
 aclParseUserList(parserNameNode *parserName, void *curlist)
 {
     void **current= curlist;
Index: squid/src/cbdata.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/cbdata.c,v
retrieving revision 1.1.1.2.12.4.4.2.2.2
retrieving revision 1.1.1.2.12.4.4.2.2.3
diff -u -r1.1.1.2.12.4.4.2.2.2 -r1.1.1.2.12.4.4.2.2.3
--- squid/src/cbdata.c	7 May 2001 13:23:41 -0000	1.1.1.2.12.4.4.2.2.2
+++ squid/src/cbdata.c	13 May 2001 14:34:42 -0000	1.1.1.2.12.4.4.2.2.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cbdata.c,v 1.1.1.2.12.4.4.2.2.2 2001/05/07 13:23:41 rbcollins Exp $
+ * $Id: cbdata.c,v 1.1.1.2.12.4.4.2.2.3 2001/05/13 14:34:42 rbcollins Exp $
  *
  * DEBUG: section 45    Callback Data Registry
  * ORIGINAL AUTHOR: Duane Wessels
@@ -89,16 +89,13 @@
 struct {
     MemPool *pool;
     FREE *free_func;
-    struct {
-      unsigned int freeonunlock:1;
-    } flags;
 }     *cbdata_index = NULL;
 int cbdata_types = 0;
 
 #define OFFSET_OF(type, member) ((int)(char *)&((type *)0L)->member)
 
 void
-cbdataInitType(cbdata_type type, char *name, int size, FREE * free_func, int freeonunlock)
+cbdataInitType(cbdata_type type, char *name, int size, FREE * free_func)
 {
     char *label;
     if (type >= cbdata_types) {
@@ -114,18 +111,15 @@
     assert(OFFSET_OF(cbdata, data) == (sizeof(cbdata) - sizeof(((cbdata *) NULL)->data)));
     cbdata_index[type].pool = memPoolCreate(label, size + OFFSET_OF(cbdata, data));
     cbdata_index[type].free_func = free_func;
-    assert(0 <= freeonunlock <= 1);
-    /* this is reversed here for perf later */
-    cbdata_index[type].flags.freeonunlock=freeonunlock ? 0 : 1;
 }
 
 cbdata_type
-cbdataAddType(cbdata_type type, char *name, int size, FREE * free_func, int freeonunlock)
+cbdataAddType(cbdata_type type, char *name, int size, FREE * free_func)
 {
     if (type)
 	return type;
     type = cbdata_types;
-    cbdataInitType(type, name, size, free_func, freeonunlock);
+    cbdataInitType(type, name, size, free_func);
     return type;
 }
 
@@ -136,8 +130,8 @@
     cachemgrRegister("cbdata",
 	"Callback Data Registry Contents",
 	cbdataDump, 0, 1);
-#define CREATE_CBDATA(type) cbdataInitType(CBDATA_##type, #type, sizeof(type), NULL, 0)
-#define CREATE_CBDATA_FREE(type, free_func) cbdataInitType(CBDATA_##type, #type, sizeof(type), free_func, 0)
+#define CREATE_CBDATA(type) cbdataInitType(CBDATA_##type, #type, sizeof(type), NULL)
+#define CREATE_CBDATA_FREE(type, free_func) cbdataInitType(CBDATA_##type, #type, sizeof(type), free_func)
     CREATE_CBDATA(acl_access);
     CREATE_CBDATA(aclCheck_t);
     CREATE_CBDATA(clientHttpRequest);
@@ -257,8 +251,7 @@
     c->file = file;
     c->line = line;
 #endif
-    /* the freeonunlock flag _is reversed_ */
-    if ((cbdata_index[c->type].flags.freeonunlock && c->valid) || c->locks)
+    if (c->valid || c->locks)
 	return;
     cbdataCount--;
     debug(45, 3) ("cbdataUnlock: Freeing %p\n", p);
Index: squid/src/comm.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/comm.c,v
retrieving revision 1.1.1.3.8.7.4.3.2.6
retrieving revision 1.1.1.3.8.7.4.3.2.7
diff -u -r1.1.1.3.8.7.4.3.2.6 -r1.1.1.3.8.7.4.3.2.7
--- squid/src/comm.c	10 May 2001 17:22:07 -0000	1.1.1.3.8.7.4.3.2.6
+++ squid/src/comm.c	13 May 2001 14:34:42 -0000	1.1.1.3.8.7.4.3.2.7
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.c,v 1.1.1.3.8.7.4.3.2.6 2001/05/10 17:22:07 adri Exp $
+ * $Id: comm.c,v 1.1.1.3.8.7.4.3.2.7 2001/05/13 14:34:42 rbcollins Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -966,8 +966,8 @@
     /* Make sure we don't have a pending event */
     assert (rstate->handler_data == NULL);
 
-    /* Make sure the given buffer is cbdata'able */
-    assert(cbdataValid(buf));
+    /* Make sure the given buffer is refcounted */
+    assert(rcdataValid(buf));
 
     /* Initialise the readstate */
     rstate->buf = buf;
@@ -980,7 +980,7 @@
     cbdataLock(handler_data);
 
     /* Ref mr buffer */
-    cbdataLock(buf);
+    rcdataReference(buf);
 
     /* Issue the read request */
     commSetSelect(fd, COMM_SELECT_READ, commHandleRead, NULL, 0);
@@ -1010,7 +1010,7 @@
     handler(fd, buf, offset, size, len, flag, handler_data);
 
     /* .. and we're finished with our data */
-    cbdataUnlock(buf);
+    rcdataDereference(buf);
     cbdataUnlock(handler_data);
 }
 
@@ -1023,7 +1023,7 @@
     CommReadStateData *rstate = &F->rstate;
 
     /* Check to see if the buffer is valid */
-    if (!cbdataValid(rstate->buf) || !cbdataValid(rstate->handler_data)) 
+    if (!rcdataValid(rstate->buf) || !cbdataValid(rstate->handler_data)) 
         return;
 
     /* Attempt a read */
Index: squid/src/defines.h
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/defines.h,v
retrieving revision 1.1.1.3.8.7.2.8.2.5
retrieving revision 1.1.1.3.8.7.2.8.2.6
diff -u -r1.1.1.3.8.7.2.8.2.5 -r1.1.1.3.8.7.2.8.2.6
--- squid/src/defines.h	13 May 2001 13:07:08 -0000	1.1.1.3.8.7.2.8.2.5
+++ squid/src/defines.h	13 May 2001 14:34:42 -0000	1.1.1.3.8.7.2.8.2.6
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.1.1.3.8.7.2.8.2.5 2001/05/13 13:07:08 rbcollins Exp $
+ * $Id: defines.h,v 1.1.1.3.8.7.2.8.2.6 2001/05/13 14:34:42 rbcollins Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -284,9 +284,15 @@
 #define cbdataFree(var) (var = (var != NULL ? cbdataInternalFree(var): NULL))
 #define CBDATA_TYPE(type)	static cbdata_type CBDATA_##type = 0
 #define CBDATA_GLOBAL_TYPE(type)	cbdata_type CBDATA_##type
-#define CBDATA_INIT_TYPE(type)	(CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), NULL, 0)))
-#define CBDATA_INIT_TYPE_FREECB(type, free_func)	(CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), free_func, 0)))
-#define CBDATA_INIT_TYPE_FREECB_ONUNLOCK(type, free_func)        (CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), free_func, 1)))
+#define CBDATA_INIT_TYPE(type)	(CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), NULL)))
+#define CBDATA_INIT_TYPE_FREECB(type, free_func)	(CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), free_func)))
+
+/* rcdata macros */
+#define rcdataAlloc(type) ((type *)rcdataInternalAlloc(RCDATA_##type))
+#define RCDATA_TYPE(type)       static rcdata_type RCDATA_##type = 0
+#define RCDATA_GLOBAL_TYPE(type)        rcdata_type RCDATA_##type
+#define RCDATA_INIT_TYPE(type)  (RCDATA_##type ? 0 : (RCDATA_##type = rcdataAddType(RCDATA_##type, #type, sizeof(type), NULL)))
+#define RCDATA_INIT_TYPE_FREECB(type, free_func)        (RCDATA_##type ? 0 : (RCDATA_##type = rcdataAddType(RCDATA_##type, #type, sizeof(type), free_func)))
 
 #ifndef O_TEXT
 #define O_TEXT 0
Index: squid/src/enums.h
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/enums.h,v
retrieving revision 1.1.1.3.8.8.4.7.2.2
retrieving revision 1.1.1.3.8.8.4.7.2.3
diff -u -r1.1.1.3.8.8.4.7.2.2 -r1.1.1.3.8.8.4.7.2.3
--- squid/src/enums.h	13 May 2001 13:07:08 -0000	1.1.1.3.8.8.4.7.2.2
+++ squid/src/enums.h	13 May 2001 14:34:42 -0000	1.1.1.3.8.8.4.7.2.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.1.1.3.8.8.4.7.2.2 2001/05/13 13:07:08 rbcollins Exp $
+ * $Id: enums.h,v 1.1.1.3.8.8.4.7.2.3 2001/05/13 14:34:42 rbcollins Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -673,6 +673,18 @@
 } cbdata_type;
 
 /*
+ * rcdata types. similar to the cbdata type above, but managed
+ * in rcdata.c. A big difference is that these types are dynamically
+ * allocated. This list is only a list of predefined types. Other types
+ * are added runtime
+ */
+typedef enum {
+    RCDATA_UNKNOWN = 0,
+    RCDATA_UNDEF = 0,
+    RCDATA_FIRST_CUSTOM_TYPE = 1000
+} rcdata_type;
+
+/*
  * Return codes from checkVary(request)
  */
 enum {
Index: squid/src/iobuf.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/Attic/iobuf.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- squid/src/iobuf.c	8 May 2001 00:22:19 -0000	1.1.2.2
+++ squid/src/iobuf.c	13 May 2001 14:34:42 -0000	1.1.2.3
@@ -1,5 +1,5 @@
 /*
- * $Id: iobuf.c,v 1.1.2.2 2001/05/08 00:22:19 rbcollins Exp $
+ * $Id: iobuf.c,v 1.1.2.3 2001/05/13 14:34:42 rbcollins Exp $
  *
  * DEBUG: section 11    IO Buffers
  * AUTHOR: Harvest Derived
@@ -41,15 +41,16 @@
 #include "squid.h"
 #include "iobuf.h"
 
-CBDATA_TYPE(iobuf);
-CBDATA_TYPE(buf4k);
+RCDATA_TYPE(iobuf);
+/* Should the buffers be mempools? */
+RCDATA_TYPE(buf4k);
 
 static void
 ioBufferFree(void *data)
 {
     iobuf *buf=data;
     if (buf->buffer)
-	cbdataUnlock(buf->buffer);
+	rcdataDereference(buf->buffer);
     /* help trap access-after-free */
     memset(buf, '\0', sizeof (iobuf));
 }
@@ -63,27 +64,21 @@
     iobuf *buf;    
 
     /* TODO init all types, set a static variable to inited, never do again */
-    CBDATA_INIT_TYPE_FREECB_ONUNLOCK(iobuf, ioBufferFree);
-    CBDATA_INIT_TYPE_FREECB_ONUNLOCK(buf4k, NULL);
+    RCDATA_INIT_TYPE_FREECB(iobuf, ioBufferFree);
+    RCDATA_INIT_TYPE(buf4k);
     
-    buf=cbdataAlloc(iobuf);
+    buf=rcdataAlloc(iobuf);
     assert(buf);
     memset(buf, '\0', sizeof (iobuf));
 
     if (buffer_size <= sizeof (buf4k)) {
 	buf->size = sizeof(buf4k);
-	buf->buffer = cbdataAlloc(buf4k);
+	buf->buffer = rcdataAlloc(buf4k);
     }
     /* else if.. else if .. */
 
     /* did we allocate a buffer successfully */ 
     assert (buf->buffer);
-    cbdataLock (buf);
-//    cbdataFree (buf);
-//    cbdataInternalFree(buf);
-    cbdataLock (buf->buffer);
-//    cbdataFree (buf->buffer);
-//    cbdataInternalFree(buf->buffer);
     return buf;
 }
 
@@ -93,12 +88,12 @@
 ioBufferLock(iobuf *buf)
 {
     assert(buf);
-    cbdataLock(buf);
+    rcdataReference(buf);
 }
 
 void
 ioBufferUnlock(iobuf *buf)
 {
     assert(buf);
-    cbdataUnlock(buf);
+    rcdataDereference(buf);
 }
Index: squid/src/main.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/main.c,v
retrieving revision 1.1.1.3.4.1.4.10.4.7.2.2
retrieving revision 1.1.1.3.4.1.4.10.4.7.2.3
diff -u -r1.1.1.3.4.1.4.10.4.7.2.2 -r1.1.1.3.4.1.4.10.4.7.2.3
--- squid/src/main.c	13 May 2001 13:07:08 -0000	1.1.1.3.4.1.4.10.4.7.2.2
+++ squid/src/main.c	13 May 2001 14:34:42 -0000	1.1.1.3.4.1.4.10.4.7.2.3
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.c,v 1.1.1.3.4.1.4.10.4.7.2.2 2001/05/13 13:07:08 rbcollins Exp $
+ * $Id: main.c,v 1.1.1.3.4.1.4.10.4.7.2.3 2001/05/13 14:34:42 rbcollins Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -643,6 +643,7 @@
 #endif
 	memInit();
 	cbdataInit();
+	rcdataInit();
 	eventInit();		/* eventInit() is required for config parsing */
 	if (!opt_do_document)
 	    parse_err = parserReconfigure(ConfigFile);
Index: squid/src/protos.h
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/protos.h,v
retrieving revision 1.1.1.3.8.11.2.20.2.8
retrieving revision 1.1.1.3.8.11.2.20.2.9
diff -u -r1.1.1.3.8.11.2.20.2.8 -r1.1.1.3.8.11.2.20.2.9
--- squid/src/protos.h	13 May 2001 13:07:08 -0000	1.1.1.3.8.11.2.20.2.8
+++ squid/src/protos.h	13 May 2001 14:34:42 -0000	1.1.1.3.8.11.2.20.2.9
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.1.1.3.8.11.2.20.2.8 2001/05/13 13:07:08 rbcollins Exp $
+ * $Id: protos.h,v 1.1.1.3.8.11.2.20.2.9 2001/05/13 14:34:42 rbcollins Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -94,10 +94,29 @@
 /* Note: Allocations is done using the cbdataAlloc macro */
 extern void *cbdataInternalFree(void *p);
 extern int cbdataValid(const void *p);
-extern void cbdataInitType(cbdata_type type, char *label, int size, FREE * free_func, int freeonunlock);
-extern cbdata_type cbdataAddType(cbdata_type type, char *label, int size, FREE * free_func, int freeonunlock);
+extern void cbdataInitType(cbdata_type type, char *label, int size, FREE * free_func);
+extern cbdata_type cbdataAddType(cbdata_type type, char *label, int size, FREE * free_func);
 extern int cbdataLocked(const void *p);
 
+/*
+ * rcdata.c
+ */
+extern void rcdataInit(void);
+#if CBDATA_DEBUG
+extern void *rcdataInternalAllocDbg(rcdata_type type, int, const char *);
+extern void rcdataReferenceDbg(const void *p, const char *, int);
+extern void rcdataDereferenceDbg(const void *p, const char *, int);
+#else
+extern void *rcdataInternalAlloc(rcdata_type type);
+extern void rcdataReference(const void *p);
+extern void rcdataDereference(const void *p);
+#endif
+/* Note: Allocations is done using the rcdataAlloc macro */
+extern int rcdataValid(const void *p);
+extern void rcdataInitType(rcdata_type type, char *label, int size, FREE * free_func);
+extern rcdata_type rcdataAddType(rcdata_type type, char *label, int size, FREE * free_func);
+extern int rcdataReferenced(const void *p);
+
 extern void clientdbInit(void);
 extern void clientdbUpdate(struct in_addr, log_type, protocol_t, size_t);
 extern int clientdbCutoffDenied(struct in_addr);
--- /dev/null	Wed Feb 14 00:52:54 2007
+++ squid/src/rcdata.c	Wed Feb 14 00:53:18 2007
@@ -0,0 +1,250 @@
+
+/*
+ * $Id: rcdata.c,v 1.1.2.1 2001/05/13 14:34:43 rbcollins Exp $
+ *
+ * DEBUG: section 45    Reference-Counted Data Registry
+ * ORIGINAL AUTHOR: Duane Wessels
+ * Modified by Moez Mahfoudh (08/12/2000)
+ * Modified by Robert Collins (13/5/2001) to be refcounted
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+/*
+ * These routines manage a set of registered ref-counted data pointers.
+ * With these routines, we register (add) ref-counted data pointers
+ * (the first reference is automatic), and then reference and dereference
+ * them. Free automatically occurs on zero references. A ref-counted data
+ * pointer is valid when the refcount is positive.
+ * 
+ * In terms of time, the sequence goes something like this:
+ * 
+ * foo = rcdataAlloc(sizeof(foo),NULL);
+ * ...
+ * rcdataReference(foo);
+ * rcdataDereference(foo);
+ * rcdataDereference(foo);<-- free is triggered here.
+ * 
+ */
+
+#include "squid.h"
+
+static int rcdataCount = 0;
+
+typedef struct _rcdata {
+    int references;
+    int type;
+#if RCDATA_DEBUG
+    const char *file;
+    int line;
+#endif
+    void *y;			/* cookie used while debugging */
+    union {
+	void *pointer;
+	double double_float;
+	int integer;
+    } data;
+} rcdata;
+
+static OBJH rcdataDump;
+
+struct {
+    MemPool *pool;
+    FREE *free_func;
+}     *rcdata_index = NULL;
+int rcdata_types = 1;
+
+#define OFFSET_OF(type, member) ((int)(char *)&((type *)0L)->member)
+
+void
+rcdataInitType(rcdata_type type, char *name, int size, FREE * free_func)
+{
+    char *label;
+    if (type >= rcdata_types) {
+	rcdata_index = xrealloc(rcdata_index, (type + 1) * sizeof(*rcdata_index));
+	memset(&rcdata_index[rcdata_types], 0,
+	    (type + 1 - rcdata_types) * sizeof(*rcdata_index));
+	rcdata_types = type + 1;
+    }
+    if (rcdata_index[type].pool)
+	return;
+    label = xmalloc(strlen(name) + 20);
+    snprintf(label, strlen(name) + 20, "rcdata %s (%d)", name, (int) type);
+    assert(OFFSET_OF(rcdata, data) == (sizeof(rcdata) - sizeof(((rcdata *) NULL)->data)));
+    rcdata_index[type].pool = memPoolCreate(label, size + OFFSET_OF(rcdata, data));
+    rcdata_index[type].free_func = free_func;
+}
+
+rcdata_type
+rcdataAddType(rcdata_type type, char *name, int size, FREE * free_func)
+{
+    if (type)
+	return type;
+    type = rcdata_types;
+    rcdataInitType(type, name, size, free_func);
+    return type;
+}
+
+void
+rcdataInit(void)
+{
+    debug(45, 3) ("rcdataInit\n");
+    cachemgrRegister("rcdata",
+	"Callback Data Registry Contents",
+	rcdataDump, 0, 1);
+#define CREATE_RCDATA(type) rcdataInitType(RCDATA_##type, #type, sizeof(type), NULL)
+#define CREATE_RCDATA_FREE(type, free_func) rcdataInitType(RCDATA_##type, #type, sizeof(type), free_func)
+}
+
+void *
+#if RCDATA_DEBUG
+rcdataInternalAllocDbg(rcdata_type type, const char *file, int line)
+#else
+rcdataInternalAlloc(rcdata_type type)
+#endif
+{
+    rcdata *p;
+    assert(type > 0 && type < rcdata_types);
+    p = memPoolAlloc(rcdata_index[type].pool);
+    p->type = type;
+    p->references = 1;
+#if RCDATA_DEBUG
+    p->file = file;
+    p->line = line;
+#endif
+    p->y = p;
+    rcdataCount++;
+
+    return (void *) &p->data;
+}
+
+void *
+rcdataInternalFree(void *p)
+{
+    rcdata *c;
+    FREE *free_func;
+    debug(45, 3) ("rcdataFree: %p\n", p);
+    c = (rcdata *) (((char *) p) - OFFSET_OF(rcdata, data));
+    assert(c->y == c);
+    if (c->references) {
+	debug(45, 3) ("rcdataFree: %p has %d references, not freeing\n",
+	    p, c->references);
+	return NULL;
+    }
+    rcdataCount--;
+    debug(45, 3) ("rcdataFree: Freeing %p\n", p);
+    free_func = rcdata_index[c->type].free_func;
+    if (free_func)
+	free_func((void *) p);
+    memPoolFree(rcdata_index[c->type].pool, c);
+    return NULL;
+}
+
+int
+rcdataReferenced(const void *p)
+{
+    rcdata *c;
+    assert(p);
+    c = (rcdata *) (((char *) p) - OFFSET_OF(rcdata, data));
+    assert(c->y == c);
+    debug(45, 3) ("rcdataReferenced: %p = %d\n", p, c->references);
+    assert(c != NULL);
+    return c->references;
+}
+
+void
+#if RCDATA_DEBUG
+rcdataReferenceDbg(const void *p, const char *file, int line)
+#else
+rcdataReference(const void *p)
+#endif
+{
+    rcdata *c;
+    if (p == NULL)
+	return;
+    c = (rcdata *) (((char *) p) - OFFSET_OF(rcdata, data));
+    assert(c->y == c);
+    debug(45, 3) ("rcdataReference: %p\n", p);
+    assert(c != NULL);
+    c->references++;
+#if RCDATA_DEBUG
+    c->file = file;
+    c->line = line;
+#endif
+}
+
+void
+#if RCDATA_DEBUG
+rcdataDereferenceDbg(const void *p, const char *file, int line)
+#else
+rcdataDereference(const void *p)
+#endif
+{
+    rcdata *c;
+    FREE *free_func;
+    if (p == NULL)
+	return;
+    c = (rcdata *) (((char *) p) - OFFSET_OF(rcdata, data));
+    assert(c->y == c);
+    debug(45, 3) ("rcdataDereference: %p\n", p);
+    assert(c != NULL);
+    assert(c->references > 0);
+    c->references--;
+#if RCDATA_DEBUG
+    c->file = file;
+    c->line = line;
+#endif
+    if (c->references)
+	return;
+    rcdataCount--;
+    debug(45, 3) ("rcdataDereference: Freeing %p\n", p);
+    free_func = rcdata_index[c->type].free_func;
+    if (free_func)
+	free_func((void *) p);
+    memPoolFree(rcdata_index[c->type].pool, c);
+}
+
+int
+rcdataValid(const void *p)
+{
+    rcdata *c;
+    if (p == NULL)
+	return 1;		/* A NULL pointer cannot become invalid */
+    debug(45, 3) ("rcdataValid: %p\n", p);
+    c = (rcdata *) (((char *) p) - OFFSET_OF(rcdata, data));
+    assert(c->y == c);
+    assert(c->references > 0);
+    return c->references;
+}
+
+static void
+rcdataDump(StoreEntry * sentry)
+{
+    storeAppendPrintf(sentry, "%d rcdata entries\n", rcdataCount);
+    storeAppendPrintf(sentry, "see also memory pools section\n");
+}
Index: squid/src/transfer-encoding.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/Attic/transfer-encoding.c,v
retrieving revision 1.1.2.1.2.8.2.1
retrieving revision 1.1.2.1.2.8.2.2
diff -u -r1.1.2.1.2.8.2.1 -r1.1.2.1.2.8.2.2
--- squid/src/transfer-encoding.c	13 May 2001 13:07:09 -0000	1.1.2.1.2.8.2.1
+++ squid/src/transfer-encoding.c	13 May 2001 14:34:43 -0000	1.1.2.1.2.8.2.2
@@ -384,7 +384,7 @@
 		state->state=1;
 		state->read_offset=0;
 		state->write_offset=0;
-		filterChainAdd(&temp_list,undochunked,identity_header, undochunked_remove,state);
+		filterChainAdd(&temp_list,undochunked, identity_header, undochunked_remove,state);
 	    }
 
 
@@ -459,7 +459,7 @@
 		state=xmalloc(sizeof(dochunk_state));
 		state->read_offset=0;
 		state->write_offset=0;
-		filterChainAddTail(&temp_list,dochunked, dochunked_remove, dochunked_remove,state);
+		filterChainAddTail(&temp_list,dochunked, identity_header, dochunked_remove,state);
                 strcat(vlb, "chunked");
                 httpHeaderPutStr(hdr, HDR_TRANSFER_ENCODING, vlb);
                 httpHeaderDelById(hdr, HDR_CONTENT_LENGTH);
Index: squid/src/modules/http_client/client_side.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/modules/http_client/Attic/client_side.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- squid/src/modules/http_client/client_side.c	11 May 2001 00:23:26 -0000	1.1.2.4
+++ squid/src/modules/http_client/client_side.c	13 May 2001 14:34:43 -0000	1.1.2.5
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.c,v 1.1.2.4 2001/05/11 00:23:26 rbcollins Exp $
+ * $Id: client_side.c,v 1.1.2.5 2001/05/13 14:34:43 rbcollins Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2440,7 +2440,8 @@
 void
 httpAccept(int sock, void *data)
 {
-    int *N = data;
+//    int *N = data;
+    int *N = &incoming_sockets_accepted;
     int fd = -1;
     ConnStateData *connState = NULL;
     struct sockaddr_in peer;
@@ -2657,3 +2658,11 @@
     }
     NHttpSockets = 0;
 }
+
+void
+clientOpenListenSockets(void)
+{
+    clientHttpConnectionsOpen();
+    if (NHttpSockets < 1)
+	fatal("Cannot open HTTP Port");
+}
