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

Christophe Fergeau cfergeau at redhat.com
Mon Oct 12 09:16:16 PDT 2015


On Mon, Oct 05, 2015 at 04:16:42PM +0200, Wolfgang Bumiller wrote:
> 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, "?");
> +        }

Looks good, though detecting the presence of ":" feels a bit magic :)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151012/eefeb5d4/attachment-0001.sig>


More information about the Spice-devel mailing list