summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-02-27 19:13:35 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-02-27 19:13:35 +0000
commit85bb19c93dbcaa9b1410c2cc93ee82ec89433576 (patch)
tree3f1bfa01716fa5ed18d3a683cc35d184ac2f8284 /content
parent3a79bcb3da85856cdc5b07b2b2fc18103c3c3567 (diff)
downloadnetsurf-85bb19c93dbcaa9b1410c2cc93ee82ec89433576.tar.gz
netsurf-85bb19c93dbcaa9b1410c2cc93ee82ec89433576.tar.bz2
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
Diffstat (limited to 'content')
-rw-r--r--content/fetchcache.c19
1 files changed, 19 insertions, 0 deletions
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: