[Spice-devel] [PATCHv2 06/10] session: parse spice+unix:// URI
Christophe Fergeau
cfergeau at redhat.com
Tue Jan 27 07:46:56 PST 2015
On Tue, Jan 27, 2015 at 02:53:19PM +0100, Marc-André Lureau wrote:
> ---
> gtk/spice-session.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index 03e0618..1050fd3 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -349,6 +349,7 @@ spice_session_finalize(GObject *gobject)
> }
>
> #define URI_SCHEME_SPICE "spice://"
> +#define URI_SCHEME_SPICE_UNIX "spice+unix://"
> #define URI_QUERY_START ";?"
> #define URI_QUERY_SEP ";&"
>
> @@ -383,10 +384,15 @@ static int spice_parse_uri(SpiceSession *session, const char *original_uri)
>
> uri = g_strdup(original_uri);
>
> + if (g_str_has_prefix(uri, URI_SCHEME_SPICE_UNIX)) {
> + path = uri + strlen(URI_SCHEME_SPICE_UNIX);
> + goto end;
> + }
> +
> /* Break up the URI into its various parts, scheme, authority,
> * path (ignored) and query
> */
> - if (strncmp(uri, URI_SCHEME_SPICE, strlen(URI_SCHEME_SPICE)) != 0) {
> + if (!g_str_has_prefix(uri, URI_SCHEME_SPICE)) {
> g_warning("Expected a URI scheme of '%s' in URI '%s'",
> URI_SCHEME_SPICE, uri);
> goto fail;
> @@ -484,19 +490,23 @@ static int spice_parse_uri(SpiceSession *session, const char *original_uri)
> }
> }
>
> + path = NULL;
I'd put this right after
unescaped_path = g_uri_unescape_string(path, NULL);
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150127/8935fa8a/attachment.sig>
More information about the Spice-devel
mailing list