[Spice-devel] [PATCH v2 2/3] session: spice_uri_create put brackets around ipv6 addresses

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Oct 5 07:16:42 PDT 2015


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/spice-session.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/spice-session.c b/src/spice-session.c
index e1d9997..86c339f 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -399,8 +399,15 @@ static gchar* spice_uri_create(SpiceSession *session)
 
         GString *str = g_string_new(URI_SCHEME_SPICE);
 
-        g_string_append(str, s->host);
-        g_string_append(str, "?");
+        /* ipv6 addresses need brackets around them */
+        if (strchr(s->host, ':')) {
+            g_string_append(str, "[");
+            g_string_append(str, s->host);
+            g_string_append(str, "]?");
+        } else {
+            g_string_append(str, s->host);
+            g_string_append(str, "?");
+        }
         if (s->port != NULL) {
             g_string_append_printf(str, "port=%s&", s->port);
         }
-- 
2.1.4




More information about the Spice-devel mailing list