From ca0daa1a668f85b846a8865c89316fbd6674caef Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 16 Apr 2010 20:08:27 +0000 Subject: [PATCH] Reset fetch state when refetching object. Ensure that cache control data is invalidated for 401/certificate failure so that conditional headers are not emitted when object is refetched. svn path=/trunk/netsurf/; revision=10408 --- content/llcache.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/content/llcache.c b/content/llcache.c index f65ac2383..a6ef49370 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -937,6 +937,9 @@ nserror llcache_object_refetch(llcache_object *object) object->cache.etag = NULL; object->cache.last_modified = 0; + /* Reset fetch state */ + object->fetch.state = LLCACHE_FETCH_INIT; + #ifdef LLCACHE_TRACE LOG(("Refetching %p", object)); #endif @@ -2077,6 +2080,9 @@ nserror llcache_fetch_auth(llcache_object *object, const char *realm) fetch_abort(object->fetch.fetch); object->fetch.fetch = NULL; + /* Invalidate cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + /* Destroy headers */ while (object->num_headers > 0) { object->num_headers--; @@ -2111,10 +2117,7 @@ nserror llcache_fetch_auth(llcache_object *object, const char *realm) } else { llcache_event event; - /* Invalidate cache-control data */ - memset(&object->cache, 0, - sizeof(llcache_cache_control)); - /* Mark it complete */ + /* Mark object complete */ object->fetch.state = LLCACHE_FETCH_COMPLETE; /* Inform client(s) that object fetch failed */ @@ -2151,6 +2154,9 @@ nserror llcache_fetch_cert_error(llcache_object *object, fetch_abort(object->fetch.fetch); object->fetch.fetch = NULL; + /* Invalidate cache-control data */ + memset(&object->cache, 0, sizeof(llcache_cache_control)); + if (query_cb != NULL) { llcache_query query; @@ -2165,9 +2171,7 @@ nserror llcache_fetch_cert_error(llcache_object *object, } else { llcache_event event; - /* Invalidate cache-control data */ - memset(&object->cache, 0, sizeof(llcache_cache_control)); - /* Mark it complete */ + /* Mark object complete */ object->fetch.state = LLCACHE_FETCH_COMPLETE; /* Inform client(s) that object fetch failed */