summaryrefslogtreecommitdiff
path: root/client/test-uri-utils.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2008-03-05 17:14:43 +0000
committerBastien Nocera <hadess@src.gnome.org>2008-03-05 17:14:43 +0000
commit7d9ad07c93149f2572e88ebc14d8163ee5b9bca6 (patch)
tree497922465b1871426a3d22ad8beef2457d5f17bc /client/test-uri-utils.c
parente0b5a4444ba8435aed29cdd9b442a2ddf0725ac4 (diff)
downloadgvfs-7d9ad07c93149f2572e88ebc14d8163ee5b9bca6.tar.gz
Fix parsing of IPv6-style hostnames to not find the port in the path
2008-03-05 Bastien Nocera <hadess@hadess.net> * client/gvfsuriutils.c (g_vfs_decode_uri): Fix parsing of IPv6-style hostnames to not find the port in the path section of the URI, fixes browing browsing ObexFTP on Nokia Series 60 phones which show drive letters as directories in the root (eg. "C:") (Closes: #520314) * client/test-uri-utils.c (main): Add test for the above, and another test for the IPv4-style URIs svn path=/trunk/; revision=1558
Diffstat (limited to 'client/test-uri-utils.c')
-rw-r--r--client/test-uri-utils.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/client/test-uri-utils.c b/client/test-uri-utils.c
index 52045671..41cfb057 100644
--- a/client/test-uri-utils.c
+++ b/client/test-uri-utils.c
@@ -14,7 +14,9 @@ static TestURIs uris[] = {
{ "https://[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]:443/", "[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]", 443 },
{ "http://test:443/", "test", 443 },
{ "http://test/", "test", -1 },
- { "obex://[00:FF:FF:FF:FF:FF]/MMC/foo.jpg", "[00:FF:FF:FF:FF:FF]", -1 }
+ { "obex://[00:FF:FF:FF:FF:FF]/MMC/foo.jpg", "[00:FF:FF:FF:FF:FF]", -1 },
+ { "obex://[00:FF:FF:FF:FF:FF]/C:", "[00:FF:FF:FF:FF:FF]", -1 },
+ { "http://windows-host:8080/C:/", "windows-host", 8080 },
};
int main (int argc, char **argv)
@@ -31,20 +33,20 @@ int main (int argc, char **argv)
return 1;
}
if (decoded->host == NULL || strcmp (decoded->host, uris[i].expected_host) != 0) {
+ g_warning ("Wrong host for \"%s\" (got '%s', expected '%s')", uris[i].uri, decoded->host, uris[i].expected_host);
g_vfs_decoded_uri_free (decoded);
- g_warning ("Wrong host for \"%s\"", uris[i].uri);
return 1;
}
if (decoded->port != uris[i].expected_port) {
- g_vfs_decoded_uri_free (decoded);
g_warning ("Wrong port for \"%s\"", uris[i].uri);
+ g_vfs_decoded_uri_free (decoded);
return 1;
}
encoded = g_vfs_encode_uri (decoded, TRUE);
if (encoded == NULL || strcmp (encoded, uris[i].uri) != 0) {
+ g_warning ("Failed to re-encode \"%s\" from '%s'", uris[i].uri, encoded);
g_vfs_decoded_uri_free (decoded);
g_free (encoded);
- g_warning ("Failed to re-encode \"%s\"", uris[i].uri);
return 1;
}
g_free (encoded);