summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-09-16 18:58:32 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-09-16 18:58:32 +0000
commitdafccf21d5b40923429ede5296e85cb6e8791d64 (patch)
treeef5d0dbf8b16fa033d23f6bba90466ae083a0a77 /content
parentbe59d5870b3efaecde6e583fc0adcbf7cdde47ce (diff)
downloadnetsurf-dafccf21d5b40923429ede5296e85cb6e8791d64.tar.gz
netsurf-dafccf21d5b40923429ede5296e85cb6e8791d64.tar.bz2
Fix validation of invalidated cache entries.
svn path=/trunk/netsurf/; revision=10785
Diffstat (limited to 'content')
-rw-r--r--content/llcache.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/content/llcache.c b/content/llcache.c
index 1f493b470..de0c56b8f 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -454,9 +454,7 @@ nserror llcache_handle_force_stream(llcache_handle *handle)
nserror llcache_handle_invalidate_cache_data(llcache_handle *handle)
{
if (handle->object != NULL && handle->object->fetch.fetch == NULL) {
- free(handle->object->cache.etag);
- memset(&handle->object->cache, 0,
- sizeof(llcache_cache_control));
+ handle->object->cache.no_cache = true;
}
return NSERROR_OK;
@@ -812,10 +810,18 @@ bool llcache_object_is_fresh(const llcache_object *object)
object->fetch.state, LLCACHE_FETCH_COMPLETE));
#endif
- /* The object is fresh if its current age is within the freshness
- * lifetime or if we're still fetching the object */
- return (freshness_lifetime > current_age ||
- object->fetch.state != LLCACHE_FETCH_COMPLETE);
+ /* The object is fresh if:
+ *
+ * it was not forbidden from being returned from the cache
+ * unvalidated (i.e. the response contained a no-cache directive)
+ *
+ * and:
+ *
+ * its current age is within the freshness lifetime
+ * or if we're still fetching the object
+ */
+ return (cd->no_cache == false && (freshness_lifetime > current_age ||
+ object->fetch.state != LLCACHE_FETCH_COMPLETE));
}
/**