[Spice-devel] [spice-gtk 05/13] spice-proxy: parse https protocol

Christophe Fergeau cfergeau at redhat.com
Tue Feb 11 08:59:33 PST 2014


On Mon, Feb 03, 2014 at 07:02:36PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> ---
>  gtk/spice-proxy.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/gtk/spice-proxy.c b/gtk/spice-proxy.c
> index 834aa10..ecf7e54 100644
> --- a/gtk/spice-proxy.c
> +++ b/gtk/spice-proxy.c
> @@ -65,9 +65,17 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err
>      uri = dup = g_strdup(proxyuri);
>      /* FIXME: use GUri when it is ready... only support http atm */
>      /* the code is voluntarily not parsing thoroughly the uri */
> -    if (g_ascii_strncasecmp("http://", uri, 7) == 0)
> +    if (g_ascii_strncasecmp("http://", uri, 7) == 0) {
>          uri += 7;
> -
> +        spice_proxy_set_protocol(self, "http");
> +        spice_proxy_set_port(self, 3128);
> +    } else if (g_ascii_strncasecmp("https://", uri, 8) == 0) {
> +        uri += 8;
> +        spice_proxy_set_protocol(self, "https");
> +        spice_proxy_set_port(self, 3129);
> +    } else {
> +        return FALSE;
> +    }
>      /* remove trailing slash */
>      len = strlen(uri);
>      for (; len > 0; len--)
> @@ -76,8 +84,6 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err
>          else
>              break;
>  
> -    spice_proxy_set_protocol(self, "http");
> -    spice_proxy_set_port(self, 3128);
>  
>      gchar *saveptr, *auth = strtok_r(uri, "@", &saveptr);
>      if (saveptr && *saveptr) {
> @@ -86,7 +92,6 @@ gboolean spice_proxy_parse(SpiceProxy *self, const gchar *proxyuri, GError **err
>          const gchar *pass = strtok_r(NULL, ":", &saveptr2);
>          spice_proxy_set_user(self, user);
>          spice_proxy_set_password(self, pass);
> -        g_debug("user: %s pass: %s", user, pass);

Unrelated to this commit.

ACK with that removed

Christophe

>          uri = saveptr;
>      }
>  
> -- 
> 1.8.4.2
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140211/733a28f9/attachment.pgp>


More information about the Spice-devel mailing list