[libsoup] soup-cache.c: do not cache multipart/x-mixed-replace content



commit 611655c62596e9d925ee6b47a00bd8812a84b77b
Author: Sergio Villar Senin <svillar igalia com>
Date:   Wed Feb 16 11:27:44 2011 +0100

    soup-cache.c: do not cache multipart/x-mixed-replace content
    
    That MIME type is normally used to stream video from webcams. Makes no sense to
    cache those resources as they are always changing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642028

 libsoup/soup-cache.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-cache.c b/libsoup/soup-cache.c
index 25c0709..49450d8 100644
--- a/libsoup/soup-cache.c
+++ b/libsoup/soup-cache.c
@@ -113,7 +113,7 @@ static SoupCacheability
 get_cacheability (SoupCache *cache, SoupMessage *msg)
 {
 	SoupCacheability cacheability;
-	const char *cache_control;
+	const char *cache_control, *content_type;
 
 	/* 1. The request method must be cacheable */
 	if (msg->method == SOUP_METHOD_GET)
@@ -125,6 +125,10 @@ get_cacheability (SoupCache *cache, SoupMessage *msg)
 	else
 		return (SOUP_CACHE_UNCACHEABLE | SOUP_CACHE_INVALIDATES);
 
+	content_type = soup_message_headers_get_content_type (msg->response_headers, NULL);
+	if (content_type && !g_ascii_strcasecmp (content_type, "multipart/x-mixed-replace"))
+		return SOUP_CACHE_UNCACHEABLE;
+
 	cache_control = soup_message_headers_get (msg->response_headers, "Cache-Control");
 	if (cache_control) {
 		GHashTable *hash;



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