summaryrefslogtreecommitdiff
path: root/libsoup/soup-content-sniffer.c
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gustavo.noronha@collabora.co.uk>2010-03-01 15:04:51 -0300
committerGustavo Noronha Silva <gns@gnome.org>2010-03-15 10:40:25 -0300
commitca01635cb89714575c551698d7a2aba19538e245 (patch)
tree13b0a61b1884fca6e3dc07b08c4bb04a0ece46e0 /libsoup/soup-content-sniffer.c
parentc758faac607015d8f8d4b25e3a692b7cedecc2e8 (diff)
downloadlibsoup-ca01635cb89714575c551698d7a2aba19538e245.tar.gz
Be less strict when checking whether to apply "text or binary"
We currently follow the spec to the letter, and only apply the text or binary algorithm when we find one of three specific content types, parameters included. It turns out we also want to run that check with almost any other text/plain variation, such as "text/plain; charset=utf-8" (only the upper-cased variant is considered today). The new behaviour matches chromium, and the spec is going to be updated, according to Adam Barth. https://bugzilla.gnome.org/show_bug.cgi?id=611502
Diffstat (limited to 'libsoup/soup-content-sniffer.c')
-rw-r--r--libsoup/soup-content-sniffer.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/libsoup/soup-content-sniffer.c b/libsoup/soup-content-sniffer.c
index d55aab5e..de90a601 100644
--- a/libsoup/soup-content-sniffer.c
+++ b/libsoup/soup-content-sniffer.c
@@ -519,12 +519,9 @@ sniff_feed_or_html (SoupContentSniffer *sniffer, SoupMessage *msg, SoupBuffer *b
static char*
sniff (SoupContentSniffer *sniffer, SoupMessage *msg, SoupBuffer *buffer, GHashTable **params)
{
- const char *content_type_with_params;
const char *content_type;
content_type = soup_message_headers_get_content_type (msg->response_headers, params);
- content_type_with_params = soup_message_headers_get_one (msg->response_headers, "Content-Type");
-
/* These comparisons are done in an ASCII-case-insensitive
* manner because the spec requires it */
@@ -553,10 +550,7 @@ sniff (SoupContentSniffer *sniffer, SoupMessage *msg, SoupBuffer *buffer, GHashT
return sniff_images (sniffer, msg, buffer, content_type);
/* If we got text/plain, use text_or_binary */
- if (g_str_equal (content_type_with_params, "text/plain") ||
- g_str_equal (content_type_with_params, "text/plain; charset=ISO-8859-1") ||
- g_str_equal (content_type_with_params, "text/plain; charset=iso-8859-1") ||
- g_str_equal (content_type_with_params, "text/plain; charset=UTF-8")) {
+ if (g_str_equal (content_type, "text/plain")) {
return sniff_text_or_binary (sniffer, msg, buffer);
}