--------------------- PatchSet 4907 Date: 2002/09/08 07:38:17 Author: rbcollins Branch: rfc2616 Tag: (none) Log: fix Vary Members: src/client_side.c:1.70.2.5->1.70.2.6 src/http.c:1.21.6.5->1.21.6.6 src/store.c:1.17.2.2->1.17.2.3 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.70.2.5 retrieving revision 1.70.2.6 diff -u -r1.70.2.5 -r1.70.2.6 --- squid/src/client_side.c 5 Sep 2002 12:39:24 -0000 1.70.2.5 +++ squid/src/client_side.c 8 Sep 2002 07:38:17 -0000 1.70.2.6 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.70.2.5 2002/09/05 12:39:24 rbcollins Exp $ + * $Id: client_side.c,v 1.70.2.6 2002/09/08 07:38:17 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1852,11 +1852,10 @@ vary = httpMakeVaryMark(request, entry->mem_obj->reply); if (vary) request->vary_headers = xstrdup(vary); - } - if (!vary) { - /* Ouch.. we cannot handle this kind of variance */ - /* XXX This cannot really happen, but just to be complete */ - return VARY_CANCEL; + else + /* Ouch.. we cannot handle this kind of variance */ + /* XXX This cannot really happen, but just to be complete */ + return VARY_CANCEL; } else if (strcmp(vary, entry->mem_obj->vary_headers) == 0) { return VARY_MATCH; } else { Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.21.6.5 retrieving revision 1.21.6.6 diff -u -r1.21.6.5 -r1.21.6.6 --- squid/src/http.c 5 Sep 2002 13:12:12 -0000 1.21.6.5 +++ squid/src/http.c 8 Sep 2002 07:38:18 -0000 1.21.6.6 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.21.6.5 2002/09/05 13:12:12 rbcollins Exp $ + * $Id: http.c,v 1.21.6.6 2002/09/08 07:38:18 rbcollins Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -436,19 +436,21 @@ */ storeEntryReplaceObject(entry, reply); + /* DO NOT USE reply now */ + reply = NULL; storeTimestampsSet(entry); /* Check if object is cacheable or not based on reply code */ - debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status); + debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", entry->mem_obj->reply->sline.status); if (neighbors_do_private_keys) - httpMaybeRemovePublic(entry, reply->sline.status); + httpMaybeRemovePublic(entry, entry->mem_obj->reply->sline.status); switch (httpCachableReply(httpState)) { case 1: - if (httpHeaderHas(&reply->header, HDR_VARY) + if (httpHeaderHas(&entry->mem_obj->reply->header, HDR_VARY) #if X_ACCELERATOR_VARY - || httpHeaderHas(&reply->header, HDR_X_ACCELERATOR_VARY) + || httpHeaderHas(&entry->mem_obj->reply->header, HDR_X_ACCELERATOR_VARY) #endif ) { - const char *vary = httpMakeVaryMark(httpState->orig_request, reply); + const char *vary = httpMakeVaryMark(httpState->orig_request, entry->mem_obj->reply); if (vary) { entry->mem_obj->vary_headers = xstrdup(vary); /* Kill the old base object if a change in variance is detected */ @@ -470,27 +472,27 @@ assert(0); break; } - if (reply->cache_control) { - if (EBIT_TEST(reply->cache_control->mask, CC_PROXY_REVALIDATE)) + if (entry->mem_obj->reply->cache_control) { + if (EBIT_TEST(entry->mem_obj->reply->cache_control->mask, CC_PROXY_REVALIDATE)) EBIT_SET(entry->flags, ENTRY_REVALIDATE); - else if (EBIT_TEST(reply->cache_control->mask, CC_MUST_REVALIDATE)) + else if (EBIT_TEST(entry->mem_obj->reply->cache_control->mask, CC_MUST_REVALIDATE)) EBIT_SET(entry->flags, ENTRY_REVALIDATE); } if (httpState->flags.keepalive) if (httpState->peer) httpState->peer->stats.n_keepalives_sent++; - if (reply->keep_alive) + if (entry->mem_obj->reply->keep_alive) if (httpState->peer) httpState->peer->stats.n_keepalives_recv++; - if (reply->date > -1 && !httpState->peer) { - int skew = abs(reply->date - squid_curtime); + if (entry->mem_obj->reply->date > -1 && !httpState->peer) { + int skew = abs(entry->mem_obj->reply->date - squid_curtime); if (skew > 86400) debug(11, 3) ("%s's clock is skewed by %d seconds!\n", httpState->request->host, skew); } ctx_exit(ctx); #if HEADERS_LOG - headersLog(1, 0, httpState->request->method, reply); + headersLog(1, 0, httpState->request->method, entry->mem_obj->reply); #endif } Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.17.2.2 retrieving revision 1.17.2.3 diff -u -r1.17.2.2 -r1.17.2.3 --- squid/src/store.c 5 Sep 2002 22:01:51 -0000 1.17.2.2 +++ squid/src/store.c 8 Sep 2002 07:38:18 -0000 1.17.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.17.2.2 2002/09/05 22:01:51 rbcollins Exp $ + * $Id: store.c,v 1.17.2.3 2002/09/08 07:38:18 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -433,7 +433,7 @@ /* We are allowed to do this typecast */ httpReplySetHeaders((HttpReply *)pe->mem_obj->reply, version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000); vary = httpHeaderGetList(&mem->reply->header, HDR_VARY); - if (strBuf(vary)) { + if (strLen(vary)) { /* Again, we own this structure layout */ httpHeaderPutStr((HttpHeader *)&pe->mem_obj->reply->header, HDR_VARY, strBuf(vary)); stringClean(&vary);