Commit 380fd731 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented IUriBuilder_{Get/Set}UserName.

parent ef8200eb
...@@ -4433,7 +4433,7 @@ static const uri_builder_test uri_builder_tests[] = { ...@@ -4433,7 +4433,7 @@ static const uri_builder_test uri_builder_tests[] = {
{TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}, {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
{TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}, {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
{TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}, {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
{TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,TRUE} {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
}, },
{FALSE}, {FALSE},
0,S_OK,TRUE, 0,S_OK,TRUE,
...@@ -4856,6 +4856,38 @@ static const uri_builder_test uri_builder_tests[] = { ...@@ -4856,6 +4856,38 @@ static const uri_builder_test uri_builder_tests[] = {
{URL_SCHEME_HTTP,S_OK}, {URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL} {URLZONE_INVALID,E_NOTIMPL}
} }
},
{ "http://:password@google.com/",0,S_OK,FALSE,
{
{FALSE},
},
{FALSE},
0,S_OK,TRUE,
0,S_OK,TRUE,
0,0,0,S_OK,TRUE,
{
{"http://:password@google.com/",S_OK},
{":password@google.com",S_OK},
{"http://google.com/",S_OK},
{"google.com",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"google.com",S_OK},
{"password",S_OK},
{"/",S_OK},
{"/",S_OK},
{"",S_FALSE},
{"http://:password@google.com/",S_OK},
{"http",S_OK},
{":password",S_OK},
{"",S_FALSE}
},
{
{Uri_HOST_DNS,S_OK},
{80,S_OK},
{URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
} }
}; };
......
...@@ -100,6 +100,9 @@ typedef struct { ...@@ -100,6 +100,9 @@ typedef struct {
WCHAR *scheme; WCHAR *scheme;
DWORD scheme_len; DWORD scheme_len;
WCHAR *username;
DWORD username_len;
} UriBuilder; } UriBuilder;
typedef struct { typedef struct {
...@@ -4383,6 +4386,7 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface) ...@@ -4383,6 +4386,7 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
heap_free(This->path); heap_free(This->path);
heap_free(This->query); heap_free(This->query);
heap_free(This->scheme); heap_free(This->scheme);
heap_free(This->username);
heap_free(This); heap_free(This);
} }
...@@ -4602,19 +4606,22 @@ static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUser ...@@ -4602,19 +4606,22 @@ static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUser
UriBuilder *This = URIBUILDER_THIS(iface); UriBuilder *This = URIBUILDER_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName); TRACE("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName);
if(!pcchUserName) { if(!This->uri || This->uri->userinfo_start == -1 ||
if(ppwzUserName) This->uri->userinfo_start == This->uri->userinfo_split ||
*ppwzUserName = NULL; This->modified_props & Uri_HAS_USER_NAME)
return E_POINTER; return get_builder_component(&This->username, &This->username_len, NULL, 0, ppwzUserName, pcchUserName);
} else {
const WCHAR *start = This->uri->canon_uri+This->uri->userinfo_start;
if(!ppwzUserName) { /* Check if there's a password in the userinfo section. */
*pcchUserName = 0; if(This->uri->userinfo_split > -1)
return E_POINTER; /* Don't include the password. */
return get_builder_component(&This->username, &This->username_len, start,
This->uri->userinfo_split, ppwzUserName, pcchUserName);
else
return get_builder_component(&This->username, &This->username_len, start,
This->uri->userinfo_len, ppwzUserName, pcchUserName);
} }
FIXME("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName);
return E_NOTIMPL;
} }
static HRESULT WINAPI UriBuilder_SetFragment(IUriBuilder *iface, LPCWSTR pwzNewValue) static HRESULT WINAPI UriBuilder_SetFragment(IUriBuilder *iface, LPCWSTR pwzNewValue)
...@@ -4679,8 +4686,9 @@ static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNe ...@@ -4679,8 +4686,9 @@ static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNe
static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue) static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
{ {
UriBuilder *This = URIBUILDER_THIS(iface); UriBuilder *This = URIBUILDER_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue)); TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
return E_NOTIMPL; return set_builder_component(&This->username, &This->username_len, pwzNewValue, 0,
&This->modified_props, Uri_HAS_USER_NAME);
} }
static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask) static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPropertyMask)
......
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