gvfs commit #2
- From: Bastien Nocera <hadess hadess net>
- To: release-team <release-team gnome org>
- Cc: alexl <alexl redhat com>
- Subject: gvfs commit #2
- Date: Wed, 05 Mar 2008 17:16:22 +0000
Heya,
Just committed this fix:
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
Cheers
Index: client/gvfsuriutils.c
===================================================================
--- client/gvfsuriutils.c (revision 1557)
+++ client/gvfsuriutils.c (working copy)
@@ -174,13 +174,39 @@
* See http://tools.ietf.org/html/rfc2732 */
if (*host_start == '[')
{
+ char *s;
+
+ port_start = NULL;
host_end = memchr (host_start, ']', authority_end - host_start);
if (host_end == NULL)
{
g_vfs_decoded_uri_free (decoded);
return NULL;
}
- port_start = memchr (host_end, ':', authority_end - host_start);
+
+ /* Look for the start of the port,
+ * And we sure we don't have it start somewhere
+ * in the path section */
+ s = (char *) host_end;
+ while (1)
+ {
+ if (*s == '/')
+ {
+ port_start = NULL;
+ break;
+ }
+ else if (*s == ':')
+ {
+ port_start = s;
+ break;
+ }
+ else if (*s == '\0')
+ {
+ break;
+ }
+
+ s++;
+ }
}
else
{
Index: client/test-uri-utils.c
===================================================================
--- client/test-uri-utils.c (revision 1557)
+++ client/test-uri-utils.c (working copy)
@@ -14,7 +14,9 @@
{ "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 @@
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_warning ("Wrong port for \"%s\"", uris[i].uri);
g_vfs_decoded_uri_free (decoded);
- g_warning ("Wrong port for \"%s\"", uris[i].uri);
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]