Commit 26a36907 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernelbase: Do not parse the hostname of internet URLs if they are missing a double slash.

parent a110b2e6
......@@ -4204,7 +4204,11 @@ static void parse_url( const WCHAR *url, struct parsed_url *pl )
work++;
pl->scheme_number = get_scheme_code(pl->scheme, pl->scheme_len);
if (!is_slash( work[0] ) || !is_slash( work[1] ))
{
if (pl->scheme_number != URL_SCHEME_FILE)
pl->scheme_number = URL_SCHEME_UNKNOWN;
return;
}
work += 2;
if (pl->scheme_number != URL_SCHEME_FILE)
......
......@@ -596,7 +596,6 @@ static void test_UrlGetPart(void)
DWORD flags;
HRESULT hr;
const char *expect;
BOOL todo_hr;
}
tests[] =
{
......@@ -657,8 +656,8 @@ static void test_UrlGetPart(void)
{"http://user@host@q", URL_PART_USERNAME, 0, S_OK, "user"},
{"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},
{"http:localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL},
{"http:/localhost/index.html", URL_PART_HOSTNAME, 0, E_FAIL},
{"http://localhost\\index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
{"http:/\\localhost/index.html", URL_PART_HOSTNAME, 0, S_OK, "localhost"},
......@@ -780,13 +779,10 @@ static void test_UrlGetPart(void)
size = 1;
strcpy(buffer, "x");
hr = UrlGetPartA(url, buffer, &size, part, flags);
todo_wine_if (tests[i].todo_hr)
{
if (tests[i].hr == S_OK)
ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
else
ok(hr == tests[i].hr, "Got hr %#lx.\n", hr);
}
if (hr == S_FALSE)
{
......@@ -796,34 +792,21 @@ static void test_UrlGetPart(void)
else
{
if (hr == E_POINTER)
{
if (expect)
{
todo_wine_if (tests[i].todo_hr)
ok(size == strlen(expect) + 1, "Got size %lu.\n", size);
}
}
else
{
ok(size == 1, "Got size %lu.\n", size);
}
ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
}
size = sizeof(buffer);
strcpy(buffer, "x");
hr = UrlGetPartA(url, buffer, &size, part, flags);
todo_wine_if (tests[i].todo_hr)
ok(hr == tests[i].hr, "Got hr %#lx.\n", hr);
if (SUCCEEDED(hr))
{
ok(size == strlen(buffer), "Got size %lu.\n", size);
if (expect)
{
todo_wine_if (tests[i].todo_hr)
ok(!strcmp(buffer, expect), "Got result %s.\n", debugstr_a(buffer));
}
}
else
{
ok(size == sizeof(buffer), "Got size %lu.\n", size);
......@@ -835,13 +818,10 @@ static void test_UrlGetPart(void)
size = 1;
wcscpy(bufferW, L"x");
hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
todo_wine_if (tests[i].todo_hr)
{
if (tests[i].hr == S_OK)
ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
else
ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
}
if (SUCCEEDED(hr))
{
......@@ -851,24 +831,15 @@ static void test_UrlGetPart(void)
else
{
if (hr == E_POINTER)
{
if (expect)
{
todo_wine_if (tests[i].todo_hr)
ok(size == strlen(expect) + 1, "Got size %lu.\n", size);
}
}
else
{
ok(size == 1, "Got size %lu.\n", size);
}
ok(!wcscmp(bufferW, L"x"), "Got result %s.\n", debugstr_w(bufferW));
}
size = ARRAY_SIZE(bufferW);
wcscpy(bufferW, L"x");
hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
todo_wine_if (tests[i].todo_hr)
ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
if (SUCCEEDED(hr))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment