Commit 1e5040ec authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Implemented IUriBuilder_{Get/Set}Host.

parent 6aa90a2d
......@@ -4288,7 +4288,7 @@ static const uri_builder_test uri_builder_tests[] = {
{ "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
{
{TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,TRUE},
{TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,TRUE},
{TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
{TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,TRUE}
},
{FALSE},
......@@ -6920,10 +6920,8 @@ static void test_IUriBuilder_HasBeenModified(void) {
hr, E_POINTER);
hr = IUriBuilder_SetHost(builder, hostW);
todo_wine {
ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
hr, S_OK);
}
hr = IUriBuilder_HasBeenModified(builder, &received);
todo_wine {
......
......@@ -82,6 +82,9 @@ typedef struct {
WCHAR *fragment;
DWORD fragment_len;
WCHAR *host;
DWORD host_len;
} UriBuilder;
typedef struct {
......@@ -4310,6 +4313,7 @@ static ULONG WINAPI UriBuilder_Release(IUriBuilder *iface)
if(!ref) {
if(This->uri) IUri_Release(URI(This->uri));
heap_free(This->fragment);
heap_free(This->host);
heap_free(This);
}
......@@ -4440,19 +4444,17 @@ static HRESULT WINAPI UriBuilder_GetHost(IUriBuilder *iface, DWORD *pcchHost, LP
UriBuilder *This = URIBUILDER_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, pcchHost, ppwzHost);
if(!pcchHost) {
if(ppwzHost)
*ppwzHost = NULL;
return E_POINTER;
}
if(!ppwzHost) {
*pcchHost = 0;
return E_POINTER;
if(!This->uri || This->uri->host_start == -1 || This->modified_props & Uri_HAS_HOST)
return get_builder_component(&This->host, &This->host_len, NULL, 0, ppwzHost, pcchHost);
else {
if(This->uri->host_type == Uri_HOST_IPV6)
/* Don't include the '[' and ']' around the address. */
return get_builder_component(&This->host, &This->host_len, This->uri->canon_uri+This->uri->host_start+1,
This->uri->host_len-2, ppwzHost, pcchHost);
else
return get_builder_component(&This->host, &This->host_len, This->uri->canon_uri+This->uri->host_start,
This->uri->host_len, ppwzHost, pcchHost);
}
FIXME("(%p)->(%p %p)\n", This, pcchHost, ppwzHost);
return E_NOTIMPL;
}
static HRESULT WINAPI UriBuilder_GetPassword(IUriBuilder *iface, DWORD *pcchPassword, LPCWSTR *ppwzPassword)
......@@ -4587,8 +4589,10 @@ static HRESULT WINAPI UriBuilder_SetFragment(IUriBuilder *iface, LPCWSTR pwzNewV
static HRESULT WINAPI UriBuilder_SetHost(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));
This->modified_props |= Uri_HAS_HOST;
return set_builder_component(&This->host, &This->host_len, pwzNewValue, 0);
}
static HRESULT WINAPI UriBuilder_SetPassword(IUriBuilder *iface, LPCWSTR pwzNewValue)
......
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