diff options
author | Bastien Nocera <hadess@hadess.net> | 2008-01-23 16:05:59 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@src.gnome.org> | 2008-01-23 16:05:59 +0000 |
commit | f070d884ef62efd8f5d1affa3d9c702f2c4557dc (patch) | |
tree | 287453eaa4ef9201c127438a6e7e7bf2ac8a7bd3 /client/gvfsuriutils.c | |
parent | 05419a9d8232e7af27e9fb31de248ebe583a002e (diff) | |
download | gvfs-f070d884ef62efd8f5d1affa3d9c702f2c4557dc.tar.gz |
Add test program for the functions in gvfsuriutils.c
2008-01-23 Bastien Nocera <hadess@hadess.net>
* client/test-uri-utils.c: (main):
* client/Makefile.am: Add test program for the
functions in gvfsuriutils.c
* client/gvfsuriutils.c: (g_vfs_decode_uri):
Fix parsing of IPv6 URIs where the host is in brackets
svn path=/trunk/; revision=1171
Diffstat (limited to 'client/gvfsuriutils.c')
-rw-r--r-- | client/gvfsuriutils.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/client/gvfsuriutils.c b/client/gvfsuriutils.c index 78aa850e..428f1ef2 100644 --- a/client/gvfsuriutils.c +++ b/client/gvfsuriutils.c @@ -170,7 +170,23 @@ g_vfs_decode_uri (const char *uri) else host_start = authority_start; - port_start = memchr (host_start, ':', authority_end - host_start); + /* We should handle hostnames in brackets, as those are used by IPv6 URIs + * See http://tools.ietf.org/html/rfc2732 */ + if (*host_start == '[') + { + 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); + } + else + { + port_start = memchr (host_start, ':', authority_end - host_start); + } + if (port_start) { host_end = port_start++; |