From: Dan Winship Date: Fri, 15 Jul 2005 17:53:11 +0000 (+0000) Subject: Allow relative URIs, since some servers are lame. Based on a patch from X-Git-Tag: LIBSOUP_2_2_5~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80e5930c51e9a0ca4405d1143e36e705960c0b9c;p=platform%2Fupstream%2Flibsoup.git Allow relative URIs, since some servers are lame. Based on a patch from * 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 --- diff --git a/ChangeLog b/ChangeLog index bead0fa..7b97462 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-15 Dan Winship + + * 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 * libsoup/soup-date.c (soup_gmtime): Mention in the doc comment diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index 24f5c4a..e9d3266 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 3cadfd7..9ff9cfe 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);