soup-cache: use the proper Content-Type when returning data from cache
authorSergio Villar Senin <svillar@igalia.com>
Fri, 1 Jun 2012 17:38:51 +0000 (19:38 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 4 Jun 2012 07:22:11 +0000 (09:22 +0200)
This does not completely fixes the content-type handling by the cache as it
does not take into account the sniffed content type. Anyway trying to return
something from the original message was clearly wrong as it was not sent.
Better use the Content-Type from the 304 response.

libsoup/soup-request-http.c

index 86a9010..9e7c945 100644 (file)
@@ -162,7 +162,7 @@ conditional_get_ready_cb (SoupSession *session, SoupMessage *msg, gpointer user_
                        /* FIXME: this is wrong; the cache won't have
                         * the sniffed type.
                         */
-                       sadata->http->priv->content_type = g_strdup (soup_message_headers_get_content_type (sadata->original->response_headers, NULL));
+                       sadata->http->priv->content_type = g_strdup (soup_message_headers_get_content_type (msg->response_headers, NULL));
 
                        g_simple_async_result_complete (sadata->simple);