Allow relative URIs, since some servers are lame. Based on a patch from
authorDan Winship <danw@src.gnome.org>
Fri, 15 Jul 2005 17:53:11 +0000 (17:53 +0000)
committerDan Winship <danw@src.gnome.org>
Fri, 15 Jul 2005 17:53:11 +0000 (17:53 +0000)
* libsoup/soup-session.c (redirect_handler): Allow relative URIs,
since some servers are lame. Based on a patch from Jean-Yves
Lefort. [#270688]

* tests/uri-parsing.c: add some more tests to make sure that
things that should be %-escaped do get %-escaped

ChangeLog
libsoup/soup-session.c
tests/uri-parsing.c

index bead0fa..7b97462 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-07-15  Dan Winship  <danw@novell.com>
+
+       * libsoup/soup-session.c (redirect_handler): Allow relative URIs,
+       since some servers are lame. Based on a patch from Jean-Yves
+       Lefort. [#270688]
+
+       * tests/uri-parsing.c: add some more tests to make sure that
+       things that should be %-escaped do get %-escaped
+
 2005-07-06  Tor Lillqvist  <tml@novell.com>
 
        * libsoup/soup-date.c (soup_gmtime): Mention in the doc comment
index 24f5c4a..e9d3266 100644 (file)
@@ -851,7 +851,11 @@ redirect_handler (SoupMessage *msg, gpointer user_data)
        new_loc = soup_message_get_header (msg->response_headers, "Location");
        if (!new_loc)
                return;
-       new_uri = soup_uri_new (new_loc);
+
+       /* Location is supposed to be an absolute URI, but some sites
+        * are lame, so we use soup_uri_new_with_base().
+        */
+       new_uri = soup_uri_new_with_base (soup_message_get_uri (msg), new_loc);
        if (!new_uri) {
                soup_message_set_status_full (msg,
                                              SOUP_STATUS_MALFORMED,
index 3cadfd7..9ff9cfe 100644 (file)
@@ -19,7 +19,16 @@ struct {
        { "http://us%65r@host", "http://user@host" },
        { "http://us%40r@host", "http://us%40r@host" },
        { "http://us%3ar@host", "http://us%3ar@host" },
-       { "http://us%2fr@host", "http://us%2fr@host" }
+       { "http://us%2fr@host", "http://us%2fr@host" },
+
+       { "http://control-chars/%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%7f",
+         "http://control-chars/%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%7f"},
+       { "http://space/%20",
+         "http://space/%20" },
+       { "http://delims/%3c%3e%23%25%22",
+         "http://delims/%3c%3e%23%25%22" },
+       { "http://unwise-chars/%7b%7d%7c%5c%5e%5b%5d%60",
+         "http://unwise-chars/%7b%7d%7c%5c%5e%5b%5d%60" }
 };
 int num_abs_tests = G_N_ELEMENTS(abs_tests);