[libsoup] soup-cache: use the status code from the stored response for expiration heuristics



commit 6d4587810ea0a6fcabfa5a8c04683b5c2de3f5db
Author: Sergio Villar Senin <svillar igalia com>
Date:   Mon Jun 4 20:51:12 2012 +0200

    soup-cache: use the status code from the stored response for expiration heuristics
    
    We must check the status code of the stored response instead of the status
    code of the SoupMessage passed to soup_cache_entry_set_freshness(). The reason
    is because the SoupMessage might be the one used to revalidate the resource
    instead of the original.

 libsoup/soup-cache.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index 6ee6dd9..2485d2e 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -419,14 +419,14 @@ soup_cache_entry_set_freshness (SoupCacheEntry *entry, SoupMessage *msg, SoupCac
 
 	/* Otherwise an heuristic may be used */
 
-	/* Heuristics MUST NOT be used with these status codes
-	   (section 2.3.1.1) */
-	if (msg->status_code != SOUP_STATUS_OK &&
-	    msg->status_code != SOUP_STATUS_NON_AUTHORITATIVE &&
-	    msg->status_code != SOUP_STATUS_PARTIAL_CONTENT &&
-	    msg->status_code != SOUP_STATUS_MULTIPLE_CHOICES &&
-	    msg->status_code != SOUP_STATUS_MOVED_PERMANENTLY &&
-	    msg->status_code != SOUP_STATUS_GONE)
+	/* Heuristics MUST NOT be used with stored responses with
+	   these status codes (section 2.3.1.1) */
+	if (entry->status_code != SOUP_STATUS_OK &&
+	    entry->status_code != SOUP_STATUS_NON_AUTHORITATIVE &&
+	    entry->status_code != SOUP_STATUS_PARTIAL_CONTENT &&
+	    entry->status_code != SOUP_STATUS_MULTIPLE_CHOICES &&
+	    entry->status_code != SOUP_STATUS_MOVED_PERMANENTLY &&
+	    entry->status_code != SOUP_STATUS_GONE)
 		goto expire;
 
 	/* TODO: attach warning 113 if response's current_age is more



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]