diff options
author | Sergio Villar Senin <svillar@igalia.com> | 2012-01-27 14:06:41 +0100 |
---|---|---|
committer | Sergio Villar Senin <svillar@igalia.com> | 2012-02-14 12:21:56 +0100 |
commit | 3c2341a11b3691639e0467a016b29d65f92b9284 (patch) | |
tree | fc72a43e78c300d55072d3ed01ac8fd42599afb1 /libsoup/soup-cache.c | |
parent | 64bdfe9eb24e219b071a06ae03cec49f15b1b71b (diff) | |
download | libsoup-3c2341a11b3691639e0467a016b29d65f92b9284.tar.gz |
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
Diffstat (limited to 'libsoup/soup-cache.c')
-rw-r--r-- | 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 e970bcb0..b001b985 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 |