diff options
author | Sergio Villar Senin <svillar@igalia.com> | 2012-06-04 20:51:12 +0200 |
---|---|---|
committer | Sergio Villar Senin <svillar@igalia.com> | 2012-06-04 20:54:51 +0200 |
commit | 6d4587810ea0a6fcabfa5a8c04683b5c2de3f5db (patch) | |
tree | 53dd4095fb01545f55534df93b02662d59ce100e | |
parent | 623c67919fbb078942058c2d739cb10d9432e45d (diff) | |
download | libsoup-6d4587810ea0a6fcabfa5a8c04683b5c2de3f5db.tar.gz libsoup-6d4587810ea0a6fcabfa5a8c04683b5c2de3f5db.tar.bz2 libsoup-6d4587810ea0a6fcabfa5a8c04683b5c2de3f5db.zip |
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.
-rw-r--r-- | 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 6ee6dd9d..2485d2eb 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 |