Zebediah Figura : kernelbase: Allow hostnames to contain any characters in UrlGetPart().
Alexandre Julliard
julliard at winehq.org
Tue Feb 15 16:07:16 CST 2022
Module: wine
Branch: master
Commit: 4ff109c3d6a40241edb1d5d642ed7aec2f69277a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4ff109c3d6a40241edb1d5d642ed7aec2f69277a
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Mon Feb 14 20:37:07 2022 -0600
kernelbase: Allow hostnames to contain any characters in UrlGetPart().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 at q", .todo_result = TRUE},
+ {"http://user@host@q", URL_PART_HOSTNAME, 0, S_OK, "host at 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},
More information about the wine-cvs
mailing list