urlmon: Implemented IUriBuilder_{Get/Set}UserName.

This commit is contained in:
Thomas Mullaly 2010-09-06 17:55:23 -04:00 committed by Alexandre Julliard
parent ef8200ebd2
commit 380fd731e2
2 changed files with 54 additions and 14 deletions

View File

@ -4433,7 +4433,7 @@ static const uri_builder_test uri_builder_tests[] = {
{TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
{TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,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},
0,S_OK,TRUE,
@ -4856,6 +4856,38 @@ static const uri_builder_test uri_builder_tests[] = {
{URL_SCHEME_HTTP,S_OK},
{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}
}
}
};

View File

@ -100,6 +100,9 @@ typedef struct {
WCHAR *scheme;
DWORD scheme_len;
WCHAR *username;
DWORD username_len;
} UriBuilder;
typedef struct {
@ -4383,6 +4386,7 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
heap_free(This->path);
heap_free(This->query);
heap_free(This->scheme);
heap_free(This->username);
heap_free(This);
}
@ -4602,19 +4606,22 @@ static HRESULT WINAPI UriBuilder_GetUserName(IUriBuilder *iface, DWORD *pcchUser
UriBuilder *This = URIBUILDER_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, pcchUserName, ppwzUserName);
if(!pcchUserName) {
if(ppwzUserName)
*ppwzUserName = NULL;
return E_POINTER;
}
if(!This->uri || This->uri->userinfo_start == -1 ||
This->uri->userinfo_start == This->uri->userinfo_split ||
This->modified_props & Uri_HAS_USER_NAME)
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) {
*pcchUserName = 0;
return E_POINTER;
/* Check if there's a password in the userinfo section. */
if(This->uri->userinfo_split > -1)
/* 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)
@ -4679,8 +4686,9 @@ static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNe
static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
{
UriBuilder *This = URIBUILDER_THIS(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
return E_NOTIMPL;
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
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)