[libsoup/wip/soup-uri-removal] sniffing-test: do not encode test paths



commit 45b00b74100347a418e9ae6a12721d4161818f5c
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Oct 13 18:07:40 2020 +0200

    sniffing-test: do not encode test paths

 tests/sniffing-test.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/tests/sniffing-test.c b/tests/sniffing-test.c
index 156af354..0a546198 100644
--- a/tests/sniffing-test.c
+++ b/tests/sniffing-test.c
@@ -94,12 +94,12 @@ server_callback (SoupServer *server, SoupMessage *msg,
                g_assert_no_error (error);
                g_free (base_name);
 
-               /* We had to escape the type strings to pass through a URI */
-                char *type = g_uri_unescape_string (components[2], NULL);
+               /* Hack to allow passing type in the URI */
+                char *ptr = g_strrstr (components[2], "_");
+                *ptr = '/';
                soup_message_headers_append (msg->response_headers,
-                                            "Content-Type", type);
+                                            "Content-Type", components[2]);
                g_strfreev (components);
-                g_free (type);
        }
 
        if (g_str_has_prefix (path, "/multiple_headers/")) {
@@ -555,55 +555,55 @@ main (int argc, char **argv)
 
        /* Test the XML sniffing path */
        g_test_add_data_func ("/sniffing/type/xml",
-                             "type/text%2Fxml/home.gif => text/xml",
+                             "type/text_xml/home.gif => text/xml",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/xml+xml",
-                             "type/anice%2Ftype+xml/home.gif => anice/type+xml",
+                             "type/anice_type+xml/home.gif => anice/type+xml",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/application-xml",
-                             "type/application%2Fxml/home.gif => application/xml",
+                             "type/application_xml/home.gif => application/xml",
                              do_sniffing_test);
 
        /* Test the feed or html path */
        g_test_add_data_func ("/sniffing/type/html/html",
-                             "type/text%2Fhtml/test.html => text/html",
+                             "type/text_html/test.html => text/html",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/html/rss",
-                             "type/text%2Fhtml/rss20.xml => application/rss+xml",
+                             "type/text_html/rss20.xml => application/rss+xml",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/html/atom",
-                             "type/text%2Fhtml/atom.xml => application/atom+xml",
+                             "type/text_html/atom.xml => application/atom+xml",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/html/rdf",
-                             "type/text%2Fhtml/feed.rdf => application/rss+xml",
+                             "type/text_html/feed.rdf => application/rss+xml",
                              do_sniffing_test);
 
        /* Test the image sniffing path */
        g_test_add_data_func ("/sniffing/type/image/gif",
-                             "type/image%2Fpng/home.gif => image/gif",
+                             "type/image_png/home.gif => image/gif",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/image/png",
-                             "type/image%2Fgif/home.png => image/png",
+                             "type/image_gif/home.png => image/png",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/image/jpeg",
-                             "type/image%2Fpng/home.jpg => image/jpeg",
+                             "type/image_png/home.jpg => image/jpeg",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/image/webp",
-                             "type/image%2Fpng/tux.webp => image/webp",
+                             "type/image_png/tux.webp => image/webp",
                              do_sniffing_test);
 
        /* Test audio and video sniffing path */
        g_test_add_data_func ("/sniffing/type/audio/wav",
-                             "type/audio%2Fmpeg/test.wav => audio/wave",
+                             "type/audio_mpeg/test.wav => audio/wave",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/audio/aiff",
-                             "type/audio%2Fmpeg/test.aiff => audio/aiff",
+                             "type/audio_mpeg/test.aiff => audio/aiff",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/audio/ogg",
-                             "type/audio%2Fmpeg/test.ogg => application/ogg",
+                             "type/audio_mpeg/test.ogg => application/ogg",
                              do_sniffing_test);
        g_test_add_data_func ("/sniffing/type/video/webm",
-                             "type/video%2Ftheora/test.webm => video/webm",
+                             "type/video_theora/test.webm => video/webm",
                              do_sniffing_test);
 
        /* Test the MP4 sniffing path */
@@ -618,7 +618,7 @@ main (int argc, char **argv)
 
        /* Test that we keep the parameters when sniffing */
        g_test_add_data_func ("/sniffing/parameters",
-                             "type/text%2Fhtml%3B%20charset=UTF-8/test.html => text/html; charset=UTF-8",
+                             "type/text_html; charset=UTF-8/test.html => text/html; charset=UTF-8",
                              do_sniffing_test);
 
        /* Test that disabling the sniffer works correctly */


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