diff options
author | Dan Winship <danw@gnome.org> | 2017-07-03 09:37:40 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2017-07-03 09:37:40 -0400 |
commit | 46a777a879a877ee9306beee0876a51a67b95ed5 (patch) | |
tree | 23a06d3fb181fdbab857bc1cbf79a8b9ee226a2b | |
parent | aefe8eac4f5b6a3df823224a38f3d20fb2308579 (diff) | |
download | libsoup-46a777a879a877ee9306beee0876a51a67b95ed5.tar.gz |
Fix sniffing of un-Content-Typed XML
https://bugs.webkit.org/show_bug.cgi?id=173923
-rw-r--r-- | libsoup/soup-content-sniffer.c | 2 | ||||
-rw-r--r-- | tests/resources/misc.xml | 11 | ||||
-rw-r--r-- | tests/sniffing-test.c | 4 | ||||
-rw-r--r-- | tests/soup-tests.gresource.xml | 1 |
4 files changed, 17 insertions, 1 deletions
diff --git a/libsoup/soup-content-sniffer.c b/libsoup/soup-content-sniffer.c index 15177827..8b4b8052 100644 --- a/libsoup/soup-content-sniffer.c +++ b/libsoup/soup-content-sniffer.c @@ -420,7 +420,7 @@ static SoupContentSnifferPattern types_table[] = { (const guchar *)"\x00\xFF\xFF\xFF\xFF\xFF", (const guchar *)" <?xml", 5, - "text/html", + "text/xml", TRUE }, { FALSE, FALSE, diff --git a/tests/resources/misc.xml b/tests/resources/misc.xml new file mode 100644 index 00000000..15361e62 --- /dev/null +++ b/tests/resources/misc.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource> + <file compressed="true">test1.txt</file> + <file preprocess="xml-stripblanks">test.gresource.xml</file> + </gresource> + <gresource prefix="/a_prefix"> + <file alias="test2-alias.txt">test2.txt</file> + <file>test2.txt</file> + </gresource> +</gresources> diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c index 1e8680bf..7b391178 100644 --- a/tests/sniffing-test.c +++ b/tests/sniffing-test.c @@ -528,6 +528,10 @@ main (int argc, char **argv) g_test_add_data_func ("/sniffing/type/unknown-leading-space", "unknown/leading_space.html => text/html", do_sniffing_test); + /* https://bugs.webkit.org/show_bug.cgi?id=173923 */ + g_test_add_data_func ("/sniffing/type/unknown-xml", + "unknown/misc.xml => text/xml", + do_sniffing_test); /* Test the XML sniffing path */ g_test_add_data_func ("/sniffing/type/xml", diff --git a/tests/soup-tests.gresource.xml b/tests/soup-tests.gresource.xml index b24a7297..9c08d170 100644 --- a/tests/soup-tests.gresource.xml +++ b/tests/soup-tests.gresource.xml @@ -13,6 +13,7 @@ <file>resources/mbox.gz</file> <file>resources/mbox.raw</file> <file>resources/mbox.zlib</file> + <file>resources/misc.xml</file> <file>resources/ps_binary.ps</file> <file>resources/rss20.xml</file> <file>resources/test.aiff</file> |