urlmon: Can't set the host of a IUriBuilder to NULL.
This commit is contained in:
parent
cbea4e2a85
commit
7e292893bd
|
@ -5295,6 +5295,72 @@ 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}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
/* Can't set the host name to NULL. */
|
||||||
|
{ "http://google.com/",0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
|
||||||
|
},
|
||||||
|
{FALSE},
|
||||||
|
0,S_OK,FALSE,
|
||||||
|
0,S_OK,FALSE,
|
||||||
|
0,0,0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{"http://google.com/",S_OK},
|
||||||
|
{"google.com",S_OK},
|
||||||
|
{"http://google.com/",S_OK},
|
||||||
|
{"google.com",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"google.com",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"/",S_OK},
|
||||||
|
{"/",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"http://google.com/",S_OK},
|
||||||
|
{"http",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_DNS,S_OK},
|
||||||
|
{80,S_OK},
|
||||||
|
{URL_SCHEME_HTTP,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/* Can set the host name to an empty string. */
|
||||||
|
{ "http://google.com/",0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
|
||||||
|
},
|
||||||
|
{FALSE},
|
||||||
|
0,S_OK,TRUE,
|
||||||
|
0,S_OK,TRUE,
|
||||||
|
0,0,0,S_OK,TRUE,
|
||||||
|
{
|
||||||
|
{"http:///",S_OK},
|
||||||
|
{"",S_OK},
|
||||||
|
{"http:///",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"/",S_OK},
|
||||||
|
{"/",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"http:///",S_OK},
|
||||||
|
{"http",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_UNKNOWN,S_OK},
|
||||||
|
{80,S_OK},
|
||||||
|
{URL_SCHEME_HTTP,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8025,10 +8091,14 @@ static void test_IUriBuilder(void) {
|
||||||
uri_builder_property prop = test.properties[j];
|
uri_builder_property prop = test.properties[j];
|
||||||
if(prop.change) {
|
if(prop.change) {
|
||||||
change_property(builder, &prop, i);
|
change_property(builder, &prop, i);
|
||||||
if(prop.property != Uri_PROPERTY_SCHEME_NAME)
|
if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
|
||||||
|
prop.property != Uri_PROPERTY_HOST)
|
||||||
modified = TRUE;
|
modified = TRUE;
|
||||||
else if(prop.value && *prop.value)
|
else if(prop.value && *prop.value)
|
||||||
modified = TRUE;
|
modified = TRUE;
|
||||||
|
else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
|
||||||
|
/* Host name property can't be NULL, but it can be empty. */
|
||||||
|
modified = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5082,6 +5082,11 @@ static HRESULT WINAPI UriBuilder_SetHost(IUriBuilder *iface, LPCWSTR pwzNewValue
|
||||||
{
|
{
|
||||||
UriBuilder *This = URIBUILDER_THIS(iface);
|
UriBuilder *This = URIBUILDER_THIS(iface);
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
|
||||||
|
|
||||||
|
/* Host name can't be set to NULL. */
|
||||||
|
if(!pwzNewValue)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
return set_builder_component(&This->host, &This->host_len, pwzNewValue, 0,
|
return set_builder_component(&This->host, &This->host_len, pwzNewValue, 0,
|
||||||
&This->modified_props, Uri_HAS_HOST);
|
&This->modified_props, Uri_HAS_HOST);
|
||||||
}
|
}
|
||||||
|
@ -5127,11 +5132,11 @@ static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNe
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
|
||||||
|
|
||||||
/* Only set the scheme name if it's not NULL or empty. */
|
/* Only set the scheme name if it's not NULL or empty. */
|
||||||
if(pwzNewValue && *pwzNewValue)
|
if(!pwzNewValue || !*pwzNewValue)
|
||||||
return set_builder_component(&This->scheme, &This->scheme_len, pwzNewValue, 0,
|
|
||||||
&This->modified_props, Uri_HAS_SCHEME_NAME);
|
|
||||||
else
|
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
return set_builder_component(&This->scheme, &This->scheme_len, pwzNewValue, 0,
|
||||||
|
&This->modified_props, Uri_HAS_SCHEME_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
|
static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
|
||||||
|
@ -5157,8 +5162,12 @@ static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPr
|
||||||
if(dwPropertyMask & Uri_HAS_FRAGMENT)
|
if(dwPropertyMask & Uri_HAS_FRAGMENT)
|
||||||
UriBuilder_SetFragment(iface, NULL);
|
UriBuilder_SetFragment(iface, NULL);
|
||||||
|
|
||||||
|
/* Even though you can't set the host name to NULL or an
|
||||||
|
* empty string, you can still remove it... for some reason.
|
||||||
|
*/
|
||||||
if(dwPropertyMask & Uri_HAS_HOST)
|
if(dwPropertyMask & Uri_HAS_HOST)
|
||||||
UriBuilder_SetHost(iface, NULL);
|
set_builder_component(&This->host, &This->host_len, NULL, 0,
|
||||||
|
&This->modified_props, Uri_HAS_HOST);
|
||||||
|
|
||||||
if(dwPropertyMask & Uri_HAS_PASSWORD)
|
if(dwPropertyMask & Uri_HAS_PASSWORD)
|
||||||
UriBuilder_SetPassword(iface, NULL);
|
UriBuilder_SetPassword(iface, NULL);
|
||||||
|
|
Loading…
Reference in New Issue