summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-06-30 14:29:46 +0200
committerOndrej Holy <oholy@redhat.com>2020-06-30 14:44:09 +0200
commit5266595595bf7cb3cf895ee04454b79aaada7c5c (patch)
tree83eba8cce95d3459fc06b3ff32115034b1ef39d8 /client
parent81babf58e59ff974369b3160a7e7e3a84ded110e (diff)
downloadgvfs-5266595595bf7cb3cf895ee04454b79aaada7c5c.tar.gz
client: Add support for zone identifiers in IPv6 addresses
The IPv6 addresses with zone identifiers are refused by GVfs currently. THis is because of g_uri_unescape_segment failure as RFC 4007 allows bare % sign to be used as separator. Although, RFC 6874 tries to fix that by the %25 separator, however, at the same time, it suggests that the bare % sign should still be accepted in user interfaces. But this would make this too complex and lead to various problems (e.g. it would not be clear what separator should be used for g_file_get_uri function). So I intentionally don't plan to support what is suggested by RFC 6874 for now, which effectively means that zone identifiers with non-ASCII chars won't be supported. Let's skip the g_uri_unescape_segment function for IPv6 address and also fix the gvfs_is_ipv6 function in order to accept the zone identifiers... Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/483
Diffstat (limited to 'client')
-rw-r--r--client/gvfsuriutils.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/client/gvfsuriutils.c b/client/gvfsuriutils.c
index 40a7afac..b7ddb6d9 100644
--- a/client/gvfsuriutils.c
+++ b/client/gvfsuriutils.c
@@ -245,7 +245,21 @@ g_vfs_decode_uri (const char *uri)
decoded->port = -1;
}
- decoded->host = g_uri_unescape_segment (host_start, host_end, NULL);
+ /* Let's use the IPv6 address without unescaping. This is needed in order
+ * to prevent g_uri_unescape_segment failures when zone identifier
+ * separated by the bare % as it is defined by RFC 4007 is used here. The
+ * zone identifier should contain just ASCII characters as per RFC 4007,
+ * so it doesn't need to be unescaped. I intentionally don't support here
+ * what is suggested by RFC 6874, which changes the separator to %25 and
+ * at the same time, it suggests that the bare % sign should still be
+ * accepted in user interfaces. Such a thing would make this too complex
+ * and lead to various problems (e.g. it would not be clear what separator
+ * should be used for g_file_get_uri function)...
+ */
+ if (*host_start == '[')
+ decoded->host = g_strndup (host_start, host_end - host_start);
+ else
+ decoded->host = g_uri_unescape_segment (host_start, host_end, NULL);
hier_part_start = authority_end;
}