--------------------- PatchSet 2765 Date: 2001/08/16 00:07:04 Author: adri Branch: diskio Tag: (none) Log: The quick modification to support zero-copy work with the HTTP code. I remember there being some small twisted and peverted bug with header parsing and this, but I don't think it applies in this case. Members: src/client_side.c:1.33->1.33.2.1 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.33 retrieving revision 1.33.2.1 diff -u -r1.33 -r1.33.2.1 --- squid/src/client_side.c 12 Aug 2001 15:20:27 -0000 1.33 +++ squid/src/client_side.c 16 Aug 2001 00:07:04 -0000 1.33.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.33 2001/08/12 15:20:27 squidadm Exp $ + * $Id: client_side.c,v 1.33.2.1 2001/08/16 00:07:04 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -207,7 +207,7 @@ delaySetStoreClient(h->sc, delayClient(h)); #endif storeClientCopy(h->sc, e, 0, 0, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), clientSendMoreData, h); + NULL, clientSendMoreData, h); return e; } @@ -399,7 +399,7 @@ http->out.offset, http->out.offset, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + NULL, clientHandleIMSReply, http); } @@ -455,11 +455,9 @@ http_status status; debug(33, 3) ("clientHandleIMSReply: %s, %d bytes\n", url, (int) size); if (entry == NULL) { - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } if (size < 0 && !EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } mem = entry->mem_obj; @@ -622,7 +620,7 @@ http->out.offset, http->out.offset, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + NULL, clientCacheHit, http); return; @@ -1410,12 +1408,10 @@ request_t *r = http->request; debug(33, 3) ("clientCacheHit: %s, %d bytes\n", http->uri, (int) size); if (http->entry == NULL) { - memFree(buf, MEM_CLIENT_SOCK_BUF); debug(33, 3) ("clientCacheHit: request aborted\n"); return; } else if (size < 0) { /* swap in failure */ - memFree(buf, MEM_CLIENT_SOCK_BUF); debug(33, 3) ("clientCacheHit: swapin failure for %s\n", http->uri); http->log_type = LOG_TCP_SWAPFAIL_MISS; if ((e = http->entry)) { @@ -1436,10 +1432,8 @@ * punt to clientProcessMiss. */ if (e->mem_status == IN_MEMORY || e->store_status == STORE_OK) { - memFree(buf, MEM_CLIENT_SOCK_BUF); clientProcessMiss(http); } else if (size == CLIENT_SOCK_SZ && http->out.offset == 0) { - memFree(buf, MEM_CLIENT_SOCK_BUF); clientProcessMiss(http); } else { debug(33, 3) ("clientCacheHit: waiting for HTTP reply headers\n"); @@ -1469,7 +1463,6 @@ /* This is not the correct entity for this request. We need * to requery the cache. */ - memFree(buf, MEM_CLIENT_SOCK_BUF); http->entry = NULL; storeUnregister(http->sc, e, http); http->sc = NULL; @@ -1483,12 +1476,10 @@ case VARY_CANCEL: /* varyEvaluateMatch found a object loop. Process as miss */ debug(33, 1) ("clientProcessHit: Vary object loop!\n"); - memFree(buf, MEM_CLIENT_SOCK_BUF); clientProcessMiss(http); return; } if (r->method == METHOD_PURGE) { - memFree(buf, MEM_CLIENT_SOCK_BUF); http->entry = NULL; storeUnregister(http->sc, e, http); http->sc = NULL; @@ -1550,7 +1541,6 @@ http->log_type = LOG_TCP_MISS; clientProcessMiss(http); } - memFree(buf, MEM_CLIENT_SOCK_BUF); } else if (r->flags.ims) { /* * Handle If-Modified-Since requests from the client @@ -1558,7 +1548,6 @@ if (mem->reply->sline.status != HTTP_OK) { debug(33, 4) ("clientCacheHit: Reply code %d != 200\n", mem->reply->sline.status); - memFree(buf, MEM_CLIENT_SOCK_BUF); http->log_type = LOG_TCP_MISS; clientProcessMiss(http); } else if (modifiedSince(e, http->request)) { @@ -1568,7 +1557,6 @@ time_t timestamp = e->timestamp; MemBuf mb = httpPacked304Reply(e->mem_obj->reply); http->log_type = LOG_TCP_IMS_HIT; - memFree(buf, MEM_CLIENT_SOCK_BUF); storeUnregister(http->sc, e, http); http->sc = NULL; storeUnlockObject(e); @@ -1837,22 +1825,18 @@ if (conn->chr != http) { /* there is another object in progress, defer this one */ debug(33, 1) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } else if (entry && EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } else if (size < 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } else if (size == 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); return; } if (http->out.offset == 0) { @@ -1983,7 +1967,6 @@ /* write */ comm_write_mbuf(fd, mb, clientWriteComplete, http); /* if we don't do it, who will? */ - memFree(buf, MEM_CLIENT_SOCK_BUF); } /* @@ -2000,7 +1983,6 @@ * (second) argument, so we pass in NULL. */ clientWriteComplete(fd, NULL, size, errflag, data); - memFree(buf, MEM_CLIENT_SOCK_BUF); } static void @@ -2049,7 +2031,7 @@ http->out.offset, http->out.offset, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + NULL, clientSendMoreData, http); } @@ -2108,7 +2090,7 @@ http->out.offset, http->out.offset, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + NULL, clientSendMoreData, http); } @@ -2311,7 +2293,7 @@ http->out.offset, http->out.offset, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + NULL, clientCacheHit, http); } else {