Commit 439600d5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernelbase: Prepend the scheme even if the requested URL part is empty.

parent 91ae5ffe
...@@ -4277,12 +4277,6 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p ...@@ -4277,12 +4277,6 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
{ {
case URL_PART_SCHEME: case URL_PART_SCHEME:
flags &= ~URL_PARTFLAG_KEEPSCHEME; flags &= ~URL_PARTFLAG_KEEPSCHEME;
if (!pl.scheme_len)
{
*out = '\0';
*out_len = 0;
return S_FALSE;
}
addr = pl.scheme; addr = pl.scheme;
size = pl.scheme_len; size = pl.scheme_len;
break; break;
...@@ -4290,30 +4284,19 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p ...@@ -4290,30 +4284,19 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
case URL_PART_HOSTNAME: case URL_PART_HOSTNAME:
if (scheme == URL_SCHEME_FILE && (!pl.hostname_len || (pl.hostname_len == 1 && *(pl.hostname + 1) == ':'))) if (scheme == URL_SCHEME_FILE && (!pl.hostname_len || (pl.hostname_len == 1 && *(pl.hostname + 1) == ':')))
{ {
*out = '\0'; addr = NULL;
*out_len = 0; size = 0;
return S_FALSE;
} }
else
if (!pl.hostname_len)
{ {
*out = '\0'; addr = pl.hostname;
*out_len = 0; size = pl.hostname_len;
return S_FALSE;
} }
addr = pl.hostname;
size = pl.hostname_len;
break; break;
case URL_PART_USERNAME: case URL_PART_USERNAME:
if (!pl.username) if (!pl.username)
return E_INVALIDARG; return E_INVALIDARG;
if (!pl.username_len)
{
*out = '\0';
*out_len = 0;
return S_FALSE;
}
addr = pl.username; addr = pl.username;
size = pl.username_len; size = pl.username_len;
break; break;
...@@ -4321,12 +4304,6 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p ...@@ -4321,12 +4304,6 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
case URL_PART_PASSWORD: case URL_PART_PASSWORD:
if (!pl.password) if (!pl.password)
return E_INVALIDARG; return E_INVALIDARG;
if (!pl.password_len)
{
*out = '\0';
*out_len = 0;
return S_FALSE;
}
addr = pl.password; addr = pl.password;
size = pl.password_len; size = pl.password_len;
break; break;
...@@ -4334,24 +4311,12 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p ...@@ -4334,24 +4311,12 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
case URL_PART_PORT: case URL_PART_PORT:
if (!pl.port) if (!pl.port)
return E_INVALIDARG; return E_INVALIDARG;
if (!pl.port_len)
{
*out = '\0';
*out_len = 0;
return S_FALSE;
}
addr = pl.port; addr = pl.port;
size = pl.port_len; size = pl.port_len;
break; break;
case URL_PART_QUERY: case URL_PART_QUERY:
flags &= ~URL_PARTFLAG_KEEPSCHEME; flags &= ~URL_PARTFLAG_KEEPSCHEME;
if (!pl.query_len)
{
*out = '\0';
*out_len = 0;
return S_FALSE;
}
addr = pl.query; addr = pl.query;
size = pl.query_len; size = pl.query_len;
break; break;
...@@ -4401,7 +4366,7 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p ...@@ -4401,7 +4366,7 @@ HRESULT WINAPI UrlGetPartW(const WCHAR *url, WCHAR *out, DWORD *out_len, DWORD p
} }
TRACE("len=%ld %s\n", *out_len, wine_dbgstr_w(out)); TRACE("len=%ld %s\n", *out_len, wine_dbgstr_w(out));
return S_OK; return *out_len ? S_OK : S_FALSE;
} }
BOOL WINAPI UrlIsA(const char *url, URLIS Urlis) BOOL WINAPI UrlIsA(const char *url, URLIS Urlis)
......
...@@ -681,7 +681,7 @@ static void test_UrlGetPart(void) ...@@ -681,7 +681,7 @@ static void test_UrlGetPart(void)
{"http://host: !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", URL_PART_PORT, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff"}, {"http://host: !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff", URL_PART_PORT, 0, S_OK, " !\"$%&'()*+,-.;<=>[]^_`{|~}\x01\x7f\xff"},
{"http:///index.html", URL_PART_HOSTNAME, 0, S_FALSE, ""}, {"http:///index.html", URL_PART_HOSTNAME, 0, S_FALSE, ""},
{"http:///index.html", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "http:", .todo_hr = TRUE}, {"http:///index.html", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "http:"},
{"file://h o s t/c:/windows/file", URL_PART_HOSTNAME, 0, S_OK, "h o s t"}, {"file://h o s t/c:/windows/file", URL_PART_HOSTNAME, 0, S_OK, "h o s t"},
{"file://h o s t/c:/windows/file", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "h o s t"}, {"file://h o s t/c:/windows/file", URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME, S_OK, "h o s t"},
{"file://foo:bar@localhost:21/file?query=x", URL_PART_USERNAME, 0, E_FAIL, .todo_hr = TRUE}, {"file://foo:bar@localhost:21/file?query=x", URL_PART_USERNAME, 0, E_FAIL, .todo_hr = TRUE},
......
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