[libsoup] SoupCache: some issues in SoupCache (1/3)
- From: Sergio Villar Senin <svillar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] SoupCache: some issues in SoupCache (1/3)
- Date: Tue, 14 Feb 2012 12:37:36 +0000 (UTC)
commit 3c2341a11b3691639e0467a016b29d65f92b9284
Author: Sergio Villar Senin <svillar igalia com>
Date: Fri Jan 27 14:06:41 2012 +0100
SoupCache: some issues in SoupCache (1/3)
Respect section 13.9 from specs. Resources whose URL has a query and do not
have expiration time provided by the server must not be cached.
https://bugzilla.gnome.org/show_bug.cgi?id=668865
libsoup/soup-cache.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index e970bcb..b001b98 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -147,6 +147,7 @@ get_cacheability (SoupCache *cache, SoupMessage *msg)
{
SoupCacheability cacheability;
const char *cache_control, *content_type;
+ gboolean has_max_age = FALSE;
/* 1. The request method must be cacheable */
if (msg->method == SOUP_METHOD_GET)
@@ -185,6 +186,9 @@ get_cacheability (SoupCache *cache, SoupMessage *msg)
return SOUP_CACHE_UNCACHEABLE;
}
+ if (g_hash_table_lookup_extended (hash, "max-age", NULL, NULL))
+ has_max_age = TRUE;
+
/* This does not appear in section 2.1, but I think it makes
* sense to check it too?
*/
@@ -196,6 +200,12 @@ get_cacheability (SoupCache *cache, SoupMessage *msg)
soup_header_free_param_list (hash);
}
+ /* Section 13.9 */
+ if ((soup_message_get_uri (msg))->query &&
+ !soup_message_headers_get_one (msg->response_headers, "Expires") &&
+ !has_max_age)
+ return SOUP_CACHE_UNCACHEABLE;
+
switch (msg->status_code) {
case SOUP_STATUS_PARTIAL_CONTENT:
/* We don't cache partial responses, but they only
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]