Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/kernelbase/path.c | 26 +++++++++++++------------- dlls/shlwapi/tests/url.c | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index 28717c25f79..954faf47a99 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -77,7 +77,6 @@ struct parsed_url enum url_scan_type { SCHEME, - HOST, PORT, USERPASS, }; @@ -4221,14 +4220,6 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ } break;
- case HOST: - while (isalnum(*start) || *start == '-' || *start == '.' || *start == ' ' || *start == '*') - { - start++; - (*size)++; - } - break; - default: FIXME("unknown type %d\n", type); return L""; @@ -4237,6 +4228,15 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ return start; }
+static const WCHAR *parse_url_element( const WCHAR *url, const WCHAR *separators ) +{ + const WCHAR *p; + + if ((p = wcspbrk( url, separators ))) + return p; + return url + wcslen( url ); +} + static LONG parse_url(const WCHAR *url, struct parsed_url *pl) { const WCHAR *work; @@ -4280,10 +4280,10 @@ static LONG parse_url(const WCHAR *url, struct parsed_url *pl) } else goto ErrorExit;
- /* now start parsing hostname or hostnumber */ - work++; - pl->hostname = work; - work = scan_url(pl->hostname, &pl->hostname_len, HOST); + pl->hostname = work + 1; + work = parse_url_element( pl->hostname, L":/\?#" ); + pl->hostname_len = work - pl->hostname; + if (*work == ':') { /* parse port */ diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c index 904d3e7bb5b..07d3ebfa331 100644 --- a/dlls/shlwapi/tests/url.c +++ b/dlls/shlwapi/tests/url.c @@ -655,7 +655,7 @@ static void test_UrlGetPart(void) {"http://user:pass:q@host", URL_PART_USERNAME, 0, S_OK, "user", .todo_hr = TRUE}, {"http://user:pass:q@host", URL_PART_PASSWORD, 0, S_OK, "pass:q", .todo_hr = TRUE}, {"http://user@host@q", URL_PART_USERNAME, 0, S_OK, "user"}, - {"http://user@host@q", URL_PART_HOSTNAME, 0, S_OK, "host@q", .todo_result = TRUE}, + {"http://user@host@q", URL_PART_HOSTNAME, 0, S_OK, "host@q"},
{"http:localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE}, {"http:/localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL, .todo_hr = TRUE},