--------------------- PatchSet 11364 Date: 2007/04/02 22:46:07 Author: hno Branch: HEAD Tag: (none) Log: Make refreshIsCachable handle ETag as a cache validator, not only last-modified Members: src/refresh.c:1.63->1.64 Index: squid/src/refresh.c =================================================================== RCS file: /cvsroot/squid/squid/src/refresh.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- squid/src/refresh.c 19 Jan 2007 00:21:01 -0000 1.63 +++ squid/src/refresh.c 2 Apr 2007 22:46:07 -0000 1.64 @@ -1,6 +1,6 @@ /* - * $Id: refresh.c,v 1.63 2007/01/19 00:21:01 hno Exp $ + * $Id: refresh.c,v 1.64 2007/04/02 22:46:07 hno Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -344,23 +344,22 @@ * immediately, and which can't be refreshed. */ int reason = refreshCheck(entry, NULL, Config.minimum_expiry_time); + int can_revalidate = 0; refreshCounts[rcStore].total++; refreshCounts[rcStore].status[reason]++; if (reason < 200) /* Does not need refresh. This is certainly cachable */ return 1; - if (entry->lastmod < 0) - /* Last modified is needed to do a refresh */ - return 0; - if (entry->mem_obj == NULL) - /* no mem_obj? */ - return 1; - if (entry->mem_obj->reply == NULL) - /* no reply? */ - return 1; - if (entry->mem_obj->reply->content_length == 0) - /* No use refreshing (caching?) 0 byte objects */ + if (entry->lastmod > 0) + can_revalidate = 1; + if (entry->mem_obj && entry->mem_obj->reply) { + if (httpHeaderHas(&entry->mem_obj->reply->header, HDR_ETAG)) + can_revalidate = 1; + } + /* Last modified is needed to do a refresh */ + if (!can_revalidate) return 0; + /* This seems to be refreshable. Cache it */ return 1; }