--------------------- PatchSet 5223 Date: 2002/10/04 21:22:09 Author: rbcollins Branch: rbcollins_cxxtest Tag: (none) Log: finished GetPUbliByRequest in client_side_reply.c Members: src/Makefile.am:1.29.2.4->1.29.2.5 src/cache_cf.cc:1.1.2.2->1.1.2.3 src/client_side_reply.cc:1.1.2.1->1.1.2.2 src/http.cc:1.1.2.2->1.1.2.3 src/auth/Makefile.am:1.2.72.1->1.2.72.2 src/fs/Makefile.am:1.3.18.1->1.3.18.2 src/repl/Makefile.am:1.3.32.1->1.3.32.2 Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Makefile.am,v retrieving revision 1.29.2.4 retrieving revision 1.29.2.5 diff -u -r1.29.2.4 -r1.29.2.5 --- squid/src/Makefile.am 4 Oct 2002 11:09:07 -0000 1.29.2.4 +++ squid/src/Makefile.am 4 Oct 2002 21:22:09 -0000 1.29.2.5 @@ -69,6 +69,7 @@ endif AM_CFLAGS = -Werror -Wall +AM_CXXFLAGS = -Werror -Wall SUBDIRS = fs repl auth Index: squid/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/cache_cf.cc,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/cache_cf.cc 4 Oct 2002 07:07:19 -0000 1.1.2.2 +++ squid/src/cache_cf.cc 4 Oct 2002 21:22:09 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.1.2.2 2002/10/04 07:07:19 rbcollins Exp $ + * $Id: cache_cf.cc,v 1.1.2.3 2002/10/04 21:22:09 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1344,7 +1344,7 @@ void parse_cachedir_options(SwapDir * sd, struct cache_dir_option *options, int reconfiguring) { - int old_read_only = sd->flags.read_only; + unsigned int old_read_only = sd->flags.read_only; char *name, *value; struct cache_dir_option *option, *op; Index: squid/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/client_side_reply.cc 4 Oct 2002 13:12:28 -0000 1.1.2.1 +++ squid/src/client_side_reply.cc 4 Oct 2002 21:22:09 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.1.2.1 2002/10/04 13:12:28 rbcollins Exp $ + * $Id: client_side_reply.cc,v 1.1.2.2 2002/10/04 21:22:09 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -50,6 +50,9 @@ void purgeFoundGet(_StoreEntry *newEntry); void purgeFoundHead(_StoreEntry *newEntry); void purgeFoundObject(_StoreEntry *entry); + void purgeDoPurgeGet(_StoreEntry *entry); + void purgeDoPurgeHead(_StoreEntry *entry); + http_status purgeStatus; /* state variable - replace with class to handle storeentries at some point */ int lookingforstore; @@ -784,12 +787,15 @@ purgeFoundGet(newEntry); else if (lookingforstore == 2) purgeFoundHead(newEntry); + else if (lookingforstore == 3) + purgeDoPurgeGet(newEntry); + else if (lookingforstore== 4); + purgeDoPurgeHead(newEntry); } void clientReplyContext::purgeFoundGet(_StoreEntry *newEntry) { - StoreEntry *entry; if (newEntry->isNull()) { lookingforstore = 2; _StoreEntry::getPublicByRequestMethod(this, http->request, METHOD_HEAD); @@ -853,38 +859,54 @@ clientReplyContext::purgeDoMissPurge() { http->logType = LOG_TCP_MISS; - /* Release the cached URI */ - StoreEntry *entry = storeGetPublicByRequestMethod(http->request, METHOD_GET); - http_status status = HTTP_NOT_FOUND; + lookingforstore = 3; + _StoreEntry::getPublicByRequestMethod(this,http->request, METHOD_GET); +} + +void +clientReplyContext::purgeDoPurgeGet(_StoreEntry *newEntry) +{ + assert (newEntry); + /* Move to new() when that is created */ + purgeStatus = HTTP_NOT_FOUND; + + if (!newEntry->isNull()) { + /* Release the cached URI */ + debug(88, 4) ("clientPurgeRequest: GET '%s'\n", storeUrl(newEntry)); + storeRelease(newEntry); + purgeStatus = HTTP_OK; + } + lookingforstore = 4; + _StoreEntry::getPublicByRequestMethod(this, http->request, METHOD_HEAD); +} + +void +clientReplyContext::purgeDoPurgeHead(_StoreEntry *newEntry) +{ + if (newEntry) { + debug(88, 4) ("clientPurgeRequest: HEAD '%s'\n", storeUrl(newEntry)); + storeRelease(newEntry); + purgeStatus = HTTP_OK; + } HttpReply *r; http_version_t version; - if (entry) { - debug(88, 4) ("clientPurgeRequest: GET '%s'\n", storeUrl(entry)); - storeRelease(entry); - status = HTTP_OK; - } - entry = storeGetPublicByRequestMethod(http->request, METHOD_HEAD); - if (entry) { - debug(88, 4) ("clientPurgeRequest: HEAD '%s'\n", storeUrl(entry)); - storeRelease(entry); - status = HTTP_OK; - } + /* And for Vary, release the base URI if none of the headers was included in the request */ if (http->request->vary_headers && !strstr(http->request->vary_headers, "=")) { - entry = storeGetPublic(urlCanonical(http->request), METHOD_GET); + StoreEntry *entry = storeGetPublic(urlCanonical(http->request), METHOD_GET); if (entry) { debug(88, 4) ("clientPurgeRequest: Vary GET '%s'\n", storeUrl(entry)); storeRelease(entry); - status = HTTP_OK; + purgeStatus = HTTP_OK; } entry = storeGetPublic(urlCanonical(http->request), METHOD_HEAD); if (entry) { debug(88, 4) ("clientPurgeRequest: Vary HEAD '%s'\n", storeUrl(entry)); storeRelease(entry); - status = HTTP_OK; + purgeStatus = HTTP_OK; } } /* @@ -897,7 +919,7 @@ triggerStoreReadWithClientParameters(this, http); httpReplyReset(r = http->entry->mem_obj->reply); httpBuildVersion(&version, 1, 0); - httpReplySetHeaders(r, version, status, NULL, NULL, 0, 0, -1); + httpReplySetHeaders(r, version, purgeStatus, NULL, NULL, 0, 0, -1); httpReplySwapOut(r, http->entry); storeComplete(http->entry); } @@ -940,7 +962,7 @@ StoreEntry *entry = http->entry; MemObject *mem; http_reply *reply; - int sendlen; + size_t sendlen; if (entry == NULL) return 0; /* @@ -1416,7 +1438,9 @@ #endif assert(context->http->logType == LOG_TCP_HIT); context->reqofs = 0; - assert(http->out.offset == http->out.size && http->out.offset == 0); + /* guarantee nothing has been sent yet! */ + assert(http->out.size == 0); + assert(http->out.offset == 0); tempBuffer.offset = context->reqofs; tempBuffer.length = next->readBuffer.length; tempBuffer.data = next->readBuffer.data; @@ -1630,7 +1654,7 @@ return 0; /* disabled */ if (clen < 0) return 0; /* unknown */ - if (clen > rep->maxBodySize) + if ((unsigned int)clen > rep->maxBodySize) return 1; /* too large */ return 0; } Index: squid/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/http.cc,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/http.cc 4 Oct 2002 07:07:26 -0000 1.1.2.2 +++ squid/src/http.cc 4 Oct 2002 21:22:09 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.1.2.2 2002/10/04 07:07:26 rbcollins Exp $ + * $Id: http.cc,v 1.1.2.3 2002/10/04 21:22:09 rbcollins Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -435,6 +435,7 @@ debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status); if (neighbors_do_private_keys) httpMaybeRemovePublic(entry, reply->sline.status); + switch (httpCachableReply(httpState)) { case 1: if (httpHeaderHas(&reply->header, HDR_VARY) Index: squid/src/auth/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/Makefile.am,v retrieving revision 1.2.72.1 retrieving revision 1.2.72.2 diff -u -r1.2.72.1 -r1.2.72.2 --- squid/src/auth/Makefile.am 3 Oct 2002 01:04:36 -0000 1.2.72.1 +++ squid/src/auth/Makefile.am 4 Oct 2002 21:22:10 -0000 1.2.72.2 @@ -3,6 +3,7 @@ # $Id$ # AUTOMAKE_OPTIONS = subdir-objects +AM_CXXFLAGS = -Werror -Wall ##DIST_SUBDIRS = basic digest ntlm ##SUBDIRS = @AUTH_MODULES@ Index: squid/src/fs/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/Makefile.am,v retrieving revision 1.3.18.1 retrieving revision 1.3.18.2 diff -u -r1.3.18.1 -r1.3.18.2 --- squid/src/fs/Makefile.am 4 Oct 2002 07:07:30 -0000 1.3.18.1 +++ squid/src/fs/Makefile.am 4 Oct 2002 21:22:10 -0000 1.3.18.2 @@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CFLAGS = -Werror -Wall +AM_CXXFLAGS = -Werror -Wall DIST_SUBDIRS = aufs coss diskd null ufs SUBDIRS = @STORE_MODULE_SUBDIRS@ Index: squid/src/repl/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/Makefile.am,v retrieving revision 1.3.32.1 retrieving revision 1.3.32.2 diff -u -r1.3.32.1 -r1.3.32.2 --- squid/src/repl/Makefile.am 4 Oct 2002 07:07:33 -0000 1.3.32.1 +++ squid/src/repl/Makefile.am 4 Oct 2002 21:22:10 -0000 1.3.32.2 @@ -5,6 +5,7 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CFLAGS = -Werror -Wall +AM_CXXFLAGS = -Werror -Wall DIST_SUBDIRS = lru heap SUBDIRS =