From 85bb19c93dbcaa9b1410c2cc93ee82ec89433576 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 27 Feb 2008 19:13:35 +0000 Subject: Mark old contents as stale if a conditional request succeeded so they'll be flushed from the cache as soon as they're unused. svn path=/trunk/netsurf/; revision=3872 --- content/fetchcache.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'content') diff --git a/content/fetchcache.c b/content/fetchcache.c index 133659557..6430f1345 100644 --- a/content/fetchcache.c +++ b/content/fetchcache.c @@ -412,6 +412,25 @@ void fetchcache_callback(fetch_msg msg, void *p, const void *data, fetch_abort(c->fetch); c->fetch = 0; } + + if (c->cache_data->date || c->cache_data->etag) { + /* We've just made a conditional request + * that returned with something other + * than 304. Therefore, there's a stale + * content floating around in the cache. + * Hunt it down and mark it as stale, so + * it'll get cleaned when unused. We + * assume it's either READY or DONE -- + * anything else is of marginal staleness + * (or in error, which will cause it to + * be flushed from the cache, anyway) + */ + struct content *stale_content = + content_get_ready(c->url); + + if (stale_content) + stale_content->fresh = false; + } break; case FETCH_PROGRESS: -- cgit v1.2.3