summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-05-19 13:52:24 +0200
committerOndrej Holy <oholy@redhat.com>2016-05-20 09:44:44 +0200
commit265c237408ec7a9ca0c02396b1e9d1bab265fb42 (patch)
treee5a14f7077aaf78d781ff26149a5efc0cfc7d1e8 /daemon
parentac81f7556da15f2851d603129a8f808f27425a75 (diff)
downloadgvfs-265c237408ec7a9ca0c02396b1e9d1bab265fb42.tar.gz
dav: Fix IPv6 address handling
It is not possible to mount WebDAV share with IPv6 address currently. GMountSpec host contains brackets around the IPv6 address, however SoupURI doesn't. This patch handles this when converting GMountSpec to SoupURI and vice versa. https://bugzilla.gnome.org/show_bug.cgi?id=766631
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsbackenddav.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 37d55bcb..4e28643f 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -1652,7 +1652,12 @@ g_mount_spec_to_dav_uri (GMountSpec *spec)
soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP);
soup_uri_set_user (uri, user);
- soup_uri_set_host (uri, host);
+
+ /* IPv6 host does not include brackets in SoupURI, but GMountSpec host does */
+ if (host[0] == '[')
+ uri->host = g_strndup (host + 1, strlen (host) - 2);
+ else
+ soup_uri_set_host (uri, host);
if (port && (port_num = atoi (port)))
soup_uri_set_port (uri, port_num);
@@ -1693,7 +1698,15 @@ g_mount_spec_from_dav_uri (GVfsBackendDav *dav_backend,
spec = g_mount_spec_new ("dav");
- g_mount_spec_set (spec, "host", uri->host);
+ /* IPv6 host does not include brackets in SoupURI, but GMountSpec host does */
+ if (strchr (uri->host, ':'))
+ {
+ char *host = g_strdup_printf ("[%s]", uri->host);
+ g_mount_spec_set (spec, "host", host);
+ g_free (host);
+ }
+ else
+ g_mount_spec_set (spec, "host", uri->host);
if (uri->scheme == SOUP_URI_SCHEME_HTTPS)
ssl = "true";