[libsoup] Be less strict when checking whether to apply "text or binary"
- From: Gustavo Noronha Silva <gns src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] Be less strict when checking whether to apply "text or binary"
- Date: Mon, 15 Mar 2010 13:42:40 +0000 (UTC)
commit ca01635cb89714575c551698d7a2aba19538e245
Author: Gustavo Noronha Silva <gustavo noronha collabora co uk>
Date: Mon Mar 1 15:04:51 2010 -0300
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
libsoup/soup-content-sniffer.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/libsoup/soup-content-sniffer.c b/libsoup/soup-content-sniffer.c
index d55aab5..de90a60 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]