diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-08-01 10:57:33 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-08-01 10:57:33 +0200 |
commit | 07308e4a46ba69b252fcde1795b64460073495e2 (patch) | |
tree | e2129e124d749126415bcf9fb298cd56668fa02b | |
parent | 4723ad8b53e0c91ce03895bf70903c381424f157 (diff) |
GMountSpec to Uri was'nt encoding the host properly for CMIS URIs.
The problem was that g_vfs_encode_uri was not encoding ':' in the
binding URL because those may appear in ipv6 hostnames. As ipv6
hostnames are in the form [theipv6], the ':[]' are unescaped only for
those ipv6 hostnames.
-rw-r--r-- | common/gvfsuriutils.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/common/gvfsuriutils.c b/common/gvfsuriutils.c index 58a71e19..2f417ef2 100644 --- a/common/gvfsuriutils.c +++ b/common/gvfsuriutils.c @@ -249,6 +249,7 @@ char * g_vfs_encode_uri (GDecodedUri *decoded, gboolean allow_utf8) { GString *uri; + gchar *host_encode_allowed; uri = g_string_new (NULL); @@ -264,10 +265,15 @@ g_vfs_encode_uri (GDecodedUri *decoded, gboolean allow_utf8) G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO, allow_utf8); g_string_append_c (uri, '@'); } - + + /* Allowed unescaped in hostname / ip address */ + host_encode_allowed = G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS; + if (decoded->host[0] == '[' && decoded->host[strlen(decoded->host) - 1] == ']') + { + host_encode_allowed = G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":[]"; + } g_string_append_uri_escaped (uri, decoded->host, - /* Allowed unescaped in hostname / ip address */ - G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS ":[]" , + host_encode_allowed, allow_utf8); if (decoded->port != -1) |