Index: squid/src/http.c diff -u squid/src/http.c:1.1.1.29.4.2 squid/src/http.c:1.1.1.29.4.3 --- squid/src/http.c:1.1.1.29.4.2 Thu Jan 14 22:26:36 1999 +++ squid/src/http.c Sat Jan 16 01:36:45 1999 @@ -222,8 +222,16 @@ case HTTP_MULTIPLE_CHOICES: case HTTP_MOVED_PERMANENTLY: case HTTP_GONE: + /* Don't cache objects that needs to be refreshed on next request + * unless we know how to refresh it + */ + if (!refreshIsCachable(httpState->entry)) + return 0; /* don't cache objects from peers w/o LMT, Date, or Expires */ /* check that is it enough to check headers @?@ */ + /* XXX This looks REALLY strange.. Ok if any of Date/LMT/Expires??? + * I have a hard time beleive that this is the intention here... + */ if (rep->date > -1) return 1; else if (rep->last_modified > -1) Index: squid/src/protos.h diff -u squid/src/protos.h:1.1.1.35.4.5 squid/src/protos.h:1.1.1.35.4.6 --- squid/src/protos.h:1.1.1.35.4.5 Fri Jan 15 06:53:02 1999 +++ squid/src/protos.h Sat Jan 16 01:36:45 1999 @@ -649,6 +649,7 @@ extern void authenticateShutdown(void); extern void refreshAddToList(const char *, int, time_t, int, time_t); +extern int refreshIsCachable(const StoreEntry *); extern int refreshCheckHTTP(const StoreEntry *, request_t *); extern int refreshCheckICP(const StoreEntry *, request_t *); extern int refreshCheckDigest(const StoreEntry *, time_t delta); Index: squid/src/refresh.c diff -u squid/src/refresh.c:1.1.1.13.10.1 squid/src/refresh.c:1.1.1.13.10.2 --- squid/src/refresh.c:1.1.1.13.10.1 Thu Jan 7 03:28:56 1999 +++ squid/src/refresh.c Sat Jan 16 01:36:46 1999 @@ -41,7 +41,7 @@ #include "squid.h" typedef enum { - rcHTTP, rcICP, rcCDigest, rcCount + rcHTTP, rcICP, rcCDigest, rcStore, rcCount } refreshCountsEnum; static struct RefreshCounts { @@ -255,6 +255,27 @@ return 1; } +int +refreshIsCachable(const StoreEntry * entry) +{ + HttpReply *rep; + /* Don't look at the request to avoid no-cache and other nuisances. + * the object should have a mem_obj so the URL will be found there + */ + /* 60 seconds delta, to avoid objects which expires almost + * immediately, and which can't be refreshed */ + if (!refreshCheck(entry, NULL, 60, &refreshCounts[rcStore])) + return 1; /* Does not need refresh. This is certainly cachable */ + if (entry->lastmod < 0) + return 0; /* Last modified is needed to do a refresh */ + rep = entry->mem_obj ? entry->mem_obj->reply : NULL; + if (rep) { + if (rep->content_length == 0) + return 0; /* No use refreshing 0 byte objects */ + } + return 1; /* This seems to be refreshable. Cache it */ +} + /* refreshCheck... functions below are protocol-specific wrappers around * refreshCheck() function above */ @@ -357,6 +378,7 @@ memset(refreshCounts, 0, sizeof(refreshCounts)); refreshCounts[rcHTTP].proto = "HTTP"; refreshCounts[rcICP].proto = "ICP"; + refreshCounts[rcStore].proto = "On Store"; refreshCounts[rcCDigest].proto = "Cache Digests"; cachemgrRegister("refresh",