"Markus Storm" writes:
>Hi *,
>
>my 1.2b15 seems to be mangling web pages for no apparent reason. I have 
>noticed this since 1.2b14. Anyone who knows?
>Dunno if it's related:
>I'm using async I/O and keep geeting messages like
>
>1998/02/19 13:37:59| clientGetHeadersForIMS: storeClientCopy failed for 
>'DB70591
>C8DF1556B3395EB57C385610C'
>
>and
>
>1998/02/19 13:38:15| storeSwapInFileOpened: /proxy-data/0E/4D/0003A6FD: 
>Size mis
>match: 2281(fstat) != 2173(object)
Try this patch:
Index: store_client.c
===================================================================
RCS file: /surf1/CVS/squid/src/store_client.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -w -u -r1.7 -r1.8
--- store_client.c	1998/02/21 00:57:03	1.7
+++ store_client.c	1998/02/25 06:46:34	1.8
@@ -221,8 +221,8 @@
     assert(sc->callback != NULL);
     if (mem->swap_hdr_sz == 0)
         file_read(sc->swapin_fd,
-	    memAllocate(MEM_DISK_BUF, 1),
-	    DISK_PAGE_SIZE,
+	    sc->copy_buf,
+	    sc->copy_size,
             0,
             storeClientReadHeader,
             sc);
@@ -254,9 +254,6 @@
 static void
 storeClientReadHeader(int fd, const char *buf, int len, int flagnotused, void *data)
 {
-    /*
-     * 'buf' should have been allocated by memAllocate(MEM_DISK_BUF)
-     */
     store_client *sc = data;
     StoreEntry *e = sc->entry;
     MemObject *mem = e->mem_obj;
@@ -271,7 +268,6 @@
     debug(20, 3) ("storeClientReadHeader: FD %d, len %d\n", fd, len);
     if (len < 0) {
         debug(20, 3) ("storeClientReadHeader: FD %d: %s\n", fd, xstrerror());
-	memFree(MEM_DISK_BUF, (void *) buf);
         sc->callback = NULL;
         callback(sc->callback_data, sc->copy_buf, len);
         return;
@@ -279,7 +275,6 @@
     tlv_list = storeSwapMetaUnpack(buf, &swap_hdr_sz);
     if (tlv_list == NULL) {
         debug(20, 1) ("storeClientReadHeader: failed to unpack meta data\n");
-	memFree(MEM_DISK_BUF, (void *) buf);
         sc->callback = NULL;
         callback(sc->callback_data, sc->copy_buf, -1);
         return;
@@ -303,8 +298,7 @@
         copy_sz = XMIN(sc->copy_size, body_sz);
         debug(20, 3) ("storeClientReadHeader: copying %d bytes of body\n",
             copy_sz);
-	xmemcpy(sc->copy_buf, buf + swap_hdr_sz, copy_sz);
-	memFree(MEM_DISK_BUF, (void *) buf);
+	xmemmove(sc->copy_buf, sc->copy_buf + swap_hdr_sz, copy_sz);
         if (sc->copy_offset == 0 && len > 0 && mem->reply->sline.status == 0)
             httpReplyParse(mem->reply, sc->copy_buf);
         sc->callback = NULL;
@@ -315,7 +309,6 @@
      * we don't have what the client wants, but at least we now
      * know the swap header size.
      */
-    memFree(MEM_DISK_BUF, (void *) buf);
     storeClientFileRead(sc);
 }
 
Duane W.
-- wessels@nlanr.net Think Globally, Cache Locally.Received on Tue Jul 29 2003 - 13:15:47 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:43 MST