--------------------- PatchSet 2408 Date: 2001/05/30 10:08:45 Author: hno Branch: etag Tag: (none) Log: Send If-None-Match on cache validations, and prepare for etag lookups on "vary" cache misses. Members: src/HttpRequest.c:1.7.14.1->1.7.14.2 src/client_side.c:1.29.2.2->1.29.2.3 src/http.c:1.13.14.3->1.13.14.4 src/structs.h:1.33.4.2->1.33.4.3 Index: squid/src/HttpRequest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpRequest.c,v retrieving revision 1.7.14.1 retrieving revision 1.7.14.2 diff -u -r1.7.14.1 -r1.7.14.2 --- squid/src/HttpRequest.c 29 May 2001 15:04:39 -0000 1.7.14.1 +++ squid/src/HttpRequest.c 30 May 2001 10:08:45 -0000 1.7.14.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.c,v 1.7.14.1 2001/05/29 15:04:39 hno Exp $ + * $Id: HttpRequest.c,v 1.7.14.2 2001/05/30 10:08:45 hno Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -67,8 +67,13 @@ httpHdrCcDestroy(req->cache_control); if (req->range) httpHdrRangeDestroy(req->range); - if (req->vary) + if (req->vary) { + if (req->etags == &req->vary->etags) + req->etags = NULL; storeLocateVaryDone(req->vary); + } + assert(req->etags == NULL); + safe_free(req->etag); memFree(req, MEM_REQUEST_T); } Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.29.2.2 retrieving revision 1.29.2.3 diff -u -r1.29.2.2 -r1.29.2.3 --- squid/src/client_side.c 29 May 2001 15:04:39 -0000 1.29.2.2 +++ squid/src/client_side.c 30 May 2001 10:08:45 -0000 1.29.2.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.29.2.2 2001/05/29 15:04:39 hno Exp $ + * $Id: client_side.c,v 1.29.2.3 2001/05/30 10:08:45 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -356,6 +356,7 @@ clientHttpRequest *http = data; char *url = http->uri; StoreEntry *entry = NULL; + const char *etag; debug(33, 3) ("clientProcessExpired: '%s'\n", http->uri); assert(http->entry->lastmod >= 0); /* @@ -390,6 +391,9 @@ debug(33, 5) ("clientProcessExpired: lastmod %d\n", (int) entry->lastmod); http->entry = entry; http->out.offset = 0; + etag = httpHeaderGetStr(&http->old_entry->mem_obj->reply->header, HDR_ETAG); + if (etag) + http->request->etag = xstrdup(etag); fwdStart(http->conn->fd, http->entry, http->request); /* Register with storage manager to receive updates when data comes in. */ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.13.14.3 retrieving revision 1.13.14.4 diff -u -r1.13.14.3 -r1.13.14.4 --- squid/src/http.c 29 May 2001 15:44:16 -0000 1.13.14.3 +++ squid/src/http.c 30 May 2001 10:08:46 -0000 1.13.14.4 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.13.14.3 2001/05/29 15:44:16 hno Exp $ + * $Id: http.c,v 1.13.14.4 2001/05/30 10:08:46 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -735,9 +735,13 @@ /* append our IMS header */ if (request->lastmod > -1 && request->method == METHOD_GET) httpHeaderPutTime(hdr_out, HDR_IF_MODIFIED_SINCE, request->lastmod); - if (request->vary) - if (request->vary->etag) - httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->vary->etag); + if (request->etag) + httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etag); + else if (request->etags) { + int i; + for (i = 0; i < request->etags->count; i++) + httpHeaderPutStr(hdr_out, HDR_IF_NONE_MATCH, request->etags->items[i]); + } /* decide if we want to do Ranges ourselves * (and fetch the whole object now) Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.33.4.2 retrieving revision 1.33.4.3 diff -u -r1.33.4.2 -r1.33.4.3 --- squid/src/structs.h 29 May 2001 15:04:39 -0000 1.33.4.2 +++ squid/src/structs.h 30 May 2001 10:08:46 -0000 1.33.4.3 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.33.4.2 2001/05/29 15:04:39 hno Exp $ + * $Id: structs.h,v 1.33.4.3 2001/05/30 10:08:46 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1610,6 +1610,8 @@ time_t lastmod; /* Used on refreshes */ char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */ VaryData *vary; + Array *etags; /* possible known entity tags (Vary MISS) */ + char *etag; /* current entity tag, cache validation */ }; struct _cachemgr_passwd {