kernelbase: Parse query strings even without a slash after the host in UrlGetPart().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-02-15 21:52:10 -06:00 committed by Alexandre Julliard
parent 562c16f421
commit 77ac962ded
2 changed files with 6 additions and 8 deletions

View File

@ -4243,15 +4243,13 @@ static LONG parse_url(const WCHAR *url, struct parsed_url *pl)
work = parse_url_element( pl->port, L"/\\?#" );
pl->port_len = work - pl->port;
}
if (*work == '/')
if ((pl->query = wcschr( work, '?' )))
{
/* see if query string */
if ((pl->query = wcschr( work, '?' )))
{
++pl->query;
pl->query_len = lstrlenW(pl->query);
}
++pl->query;
pl->query_len = lstrlenW(pl->query);
}
SuccessExit:
TRACE("parse successful: scheme=%p(%ld), user=%p(%ld), pass=%p(%ld), host=%p(%ld), port=%p(%ld), query=%p(%ld)\n",
pl->scheme, pl->scheme_len, pl->username, pl->username_len, pl->password, pl->password_len, pl->hostname,

View File

@ -669,7 +669,7 @@ static void test_UrlGetPart(void)
{"ftp:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
{"http://host?a:b@c:d", URL_PART_HOSTNAME, 0, S_OK, "host"},
{"http://host?a:b@c:d", URL_PART_QUERY, 0, S_OK, "a:b@c:d", .todo_hr = TRUE},
{"http://host?a:b@c:d", URL_PART_QUERY, 0, S_OK, "a:b@c:d"},
{"http://host#a:b@c:d", URL_PART_HOSTNAME, 0, S_OK, "host"},
{"http://host#a:b@c:d", URL_PART_QUERY, 0, S_FALSE, ""},