guri: always apply the remove dot segments algorithm

And not only when g_uri_parse_relative() is called with a base uri. This
follows the spec and it's compatible with SoupURI.

Fixes #2342
This commit is contained in:
Carlos Garcia Campos 2021-05-05 15:13:16 +02:00
parent 2cb303b7aa
commit 7e428aa4e5
2 changed files with 5 additions and 1 deletions

View File

@ -1508,6 +1508,10 @@ g_uri_parse_relative (GUri *base_uri,
uri->port = normalize_port (uri->scheme, uri->port); uri->port = normalize_port (uri->scheme, uri->port);
} }
} }
else
{
remove_dot_segments (uri->path);
}
return g_steal_pointer (&uri); return g_steal_pointer (&uri);
} }

View File

@ -714,7 +714,7 @@ static const UriAbsoluteTest absolute_tests[] = {
/* ".." past top */ /* ".." past top */
{ "http://example.com/..", G_URI_FLAGS_NONE, TRUE, 0, { "http://example.com/..", G_URI_FLAGS_NONE, TRUE, 0,
{ "http", NULL, "example.com", -1, "/..", NULL, NULL } { "http", NULL, "example.com", -1, "/", NULL, NULL }
}, },
/* scheme parsing */ /* scheme parsing */