kernelbase: Allow the two initial slashes to be backslashes 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-16 20:31:40 -06:00 committed by Alexandre Julliard
parent 71bf5b24d7
commit b72f7afc8b
2 changed files with 11 additions and 5 deletions

View File

@ -4191,6 +4191,11 @@ static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators
return url + wcslen( url );
}
static BOOL is_slash( char c )
{
return c == '/' || c == '\\';
}
static void parse_url( const WCHAR *url, struct parsed_url *pl )
{
const WCHAR *work;
@ -4200,7 +4205,8 @@ static void parse_url( const WCHAR *url, struct parsed_url *pl )
work = scan_url(pl->scheme, &pl->scheme_len, SCHEME);
if (!*work || (*work != ':')) return;
work++;
if ((*work != '/') || (*(work+1) != '/')) return;
if (!is_slash( work[0] ) || !is_slash( work[1] ))
return;
pl->username = work + 2;
work = parse_url_element( pl->username, L":@/\\?#" );

View File

@ -661,12 +661,12 @@ static void test_UrlGetPart(void)
{"http:/localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE},
{"http://localhost\\index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
{"http:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
{"http:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"ftp://localhost\\index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"ftp:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
{"ftp:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost", .todo_hr = TRUE},
{"ftp:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"ftp:\\/localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"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"},