diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | libsoup/soup-session.c | 6 | ||||
-rw-r--r-- | tests/uri-parsing.c | 11 |
3 files changed, 24 insertions, 2 deletions
@@ -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 diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 24f5c4a5..e9d32662 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -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, diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c index 3cadfd77..9ff9cfed 100644 --- a/tests/uri-parsing.c +++ b/tests/uri-parsing.c @@ -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); |