[libsoup] soup-cache: check for empy Cache-Control headers



commit 96fc865429ee5b34f2753e56754e19b0610c778b
Author: Sergio Villar Senin <svillar igalia com>
Date:   Wed Sep 5 17:08:55 2012 +0200

    soup-cache: check for empy Cache-Control headers
    
    Some sites return empty "Cache-Control" headers. We should add an emptiness
    check to the existing NULL checks before trying to do things like
    soup_header_parse_param_list().

 libsoup/soup-cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index 51abbe5..50ea592 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -331,7 +331,7 @@ soup_cache_entry_set_freshness (SoupCacheEntry *entry, SoupMessage *msg, SoupCac
 	const char *expires, *date, *last_modified;
 
 	cache_control = soup_message_headers_get_list (entry->headers, "Cache-Control");
-	if (cache_control) {
+	if (cache_control && *cache_control) {
 		const char *max_age, *s_maxage;
 		gint64 freshness_lifetime = 0;
 		GHashTable *hash;
@@ -1348,7 +1348,7 @@ soup_cache_has_response (SoupCache *cache, SoupMessage *msg)
 		return SOUP_CACHE_RESPONSE_STALE;
 
 	cache_control = soup_message_headers_get_list (msg->request_headers, "Cache-Control");
-	if (cache_control) {
+	if (cache_control && *cache_control) {
 		GHashTable *hash = soup_header_parse_param_list (cache_control);
 
 		if (g_hash_table_lookup_extended (hash, "no-store", NULL, NULL)) {



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