Author: jmb
Date: Wed Feb 27 19:13:35 2008
New Revision: 3872
URL:
http://source.netsurf-browser.org?rev=3872&view=rev
Log:
Mark old contents as stale if a conditional request succeeded so they'll be flushed
from the cache as soon as they're unused.
Modified:
trunk/netsurf/content/fetchcache.c
Modified: trunk/netsurf/content/fetchcache.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/content/fetchcache.c?rev=...
==============================================================================
--- trunk/netsurf/content/fetchcache.c (original)
+++ trunk/netsurf/content/fetchcache.c Wed Feb 27 19:13:35 2008
@@ -411,6 +411,25 @@
if (!res) {
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;