diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-09-16 18:58:32 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-09-16 18:58:32 +0000 |
commit | dafccf21d5b40923429ede5296e85cb6e8791d64 (patch) | |
tree | ef5d0dbf8b16fa033d23f6bba90466ae083a0a77 | |
parent | be59d5870b3efaecde6e583fc0adcbf7cdde47ce (diff) | |
download | netsurf-dafccf21d5b40923429ede5296e85cb6e8791d64.tar.gz netsurf-dafccf21d5b40923429ede5296e85cb6e8791d64.tar.bz2 |
Fix validation of invalidated cache entries.
svn path=/trunk/netsurf/; revision=10785
-rw-r--r-- | content/llcache.c | 20 |
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)); } /** |