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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Wolfgang Bumiller <w.bumiller@xxxxxxxxxxx>
---
 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


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]