When parsing an URI, spice_uri_parse currently first looks up for '/' to detect the 'path' part of the URI (http://foo.example.com/some/path) and then the query part (starting with '&' is looked up). However, this does not work as expected when the host name is not followed by a path, but the query part contains a path: http://foo.example.com&my_param=/some/path This commit starts inverts the path detection/query detection step, it first detects the beginning of the query part and splits it out, and then looks for '/' in the part which came before the query part. --- gtk/spice-session.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 8cb2d39..83b91db 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -281,7 +281,6 @@ spice_session_finalize(GObject *gobject) #define URI_SCHEME_SPICE "spice://" #define URI_QUERY_START ";?" -#define URI_QUERY_SEP ";&" static int spice_uri_create(SpiceSession *session, char *dest, int len) { @@ -322,24 +321,20 @@ static int spice_uri_parse(SpiceSession *session, const char *original_uri) goto fail; } authority = uri + strlen(URI_SCHEME_SPICE); + + query = authority + strcspn(authority, URI_QUERY_START); + if (query[0]) { + query[0] = '\0'; + query++; + } + path = strchr(authority, '/'); if (path) { path[0] = '\0'; path++; } - if (path) { - size_t prefix = strcspn(path, URI_QUERY_START); - query = path + prefix; - } else { - size_t prefix = strcspn(authority, URI_QUERY_START); - query = authority + prefix; - } - if (query && query[0]) { - query[0] = '\0'; - query++; - } /* Now process the individual parts */ -- 1.8.2.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel