[PATCH 1/4] kernelbase: Allow the two initial slashes to be backslashes in UrlGetPart().
Zebediah Figura
zfigura at codeweavers.com
Wed Feb 16 20:31:40 CST 2022
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/kernelbase/path.c | 8 +++++++-
dlls/shlwapi/tests/url.c | 8 ++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index e29ee585123..befdf237c5e 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -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":@/\\?#" );
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 18af0906e08..ae0d0738195 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -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 at c:d"},
--
2.34.1
More information about the wine-devel
mailing list