[libsoup] soup-session.c: do not emit content-sniffed if it isn't cached



commit 118062681c732e57fc2851cd21c34cab2579c9f4
Author: Sergio Villar Senin <svillar igalia com>
Date:   Tue Feb 19 15:44:17 2013 +0100

    soup-session.c: do not emit content-sniffed if it isn't cached
    
    The SoupCache does not get any information from sniffed content types as it
    works at a lower level. That's why sometimes we might not have any
    Content-Type information for a cached resource (if the server does not
    specify it).

 libsoup/soup-session.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index ab13ca9..b0fc1d5 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -3764,13 +3764,15 @@ async_return_from_cache (SoupMessageQueueItem *item,
                         GInputStream         *stream)
 {
        const char *content_type;
-       GHashTable *params;
+       GHashTable *params = NULL;
 
        soup_message_got_headers (item->msg);
 
        content_type = soup_message_headers_get_content_type (item->msg->response_headers, &params);
-       soup_message_content_sniffed (item->msg, content_type, params);
-       g_hash_table_unref (params);
+       if (content_type) {
+               soup_message_content_sniffed (item->msg, content_type, params);
+               g_hash_table_unref (params);
+       }
 
        item->state = SOUP_MESSAGE_FINISHING;
        async_send_request_return_result (item, g_object_ref (stream), NULL);


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