summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2005-07-15 17:53:11 +0000
committerDan Winship <danw@src.gnome.org>2005-07-15 17:53:11 +0000
commit80e5930c51e9a0ca4405d1143e36e705960c0b9c (patch)
tree648a9db8d2ec3c9658d4ff71edc7b6a05c70a9d9
parentcae3d1ef8797284138bf3f7d5a0f0a92fafdee1a (diff)
downloadlibsoup-80e5930c51e9a0ca4405d1143e36e705960c0b9c.tar.gz
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
-rw-r--r--ChangeLog9
-rw-r--r--libsoup/soup-session.c6
-rw-r--r--tests/uri-parsing.c11
3 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index bead0fac..7b974628 100644
--- 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
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);