urlmon: Some IUri's don't include the userinfo component in the absolute URI string.
This commit is contained in:
parent
7f6faca6f6
commit
ef8200ebd2
|
@ -4029,6 +4029,158 @@ static const uri_properties uri_tests[] = {
|
|||
{URL_SCHEME_FILE,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
},
|
||||
/* Doesn't have a UserName since the ':' appears at the beginning of the
|
||||
* userinfo section.
|
||||
*/
|
||||
{ "http://:password@gov.uk", 0, S_OK, FALSE,
|
||||
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
|
||||
Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
|
||||
Uri_HAS_USER_INFO|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
|
||||
FALSE,
|
||||
{
|
||||
{"http://:password@gov.uk/",S_OK,FALSE},
|
||||
{":password@gov.uk",S_OK,FALSE},
|
||||
{"http://gov.uk/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"gov.uk",S_OK,FALSE},
|
||||
{"password",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"http://:password@gov.uk",S_OK,FALSE},
|
||||
{"http",S_OK,FALSE},
|
||||
{":password",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE}
|
||||
},
|
||||
{
|
||||
{Uri_HOST_DNS,S_OK,FALSE},
|
||||
{80,S_OK,FALSE},
|
||||
{URL_SCHEME_HTTP,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
},
|
||||
/* Has a UserName since the userinfo section doesn't contain a password. */
|
||||
{ "http://@gov.uk", 0, S_OK, FALSE,
|
||||
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
|
||||
Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
|
||||
Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
|
||||
FALSE,
|
||||
{
|
||||
{"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
|
||||
{"@gov.uk",S_OK,FALSE},
|
||||
{"http://gov.uk/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"gov.uk",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"http://@gov.uk",S_OK,FALSE},
|
||||
{"http",S_OK,FALSE},
|
||||
{"",S_OK,FALSE},
|
||||
{"",S_OK,FALSE}
|
||||
},
|
||||
{
|
||||
{Uri_HOST_DNS,S_OK,FALSE},
|
||||
{80,S_OK,FALSE},
|
||||
{URL_SCHEME_HTTP,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
},
|
||||
/* ":@" not included in the absolute URI. */
|
||||
{ "http://:@gov.uk", 0, S_OK, FALSE,
|
||||
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
|
||||
Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
|
||||
Uri_HAS_USER_INFO|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME,
|
||||
FALSE,
|
||||
{
|
||||
{"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
|
||||
{":@gov.uk",S_OK,FALSE},
|
||||
{"http://gov.uk/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"gov.uk",S_OK,FALSE},
|
||||
{"",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"http://:@gov.uk",S_OK,FALSE},
|
||||
{"http",S_OK,FALSE},
|
||||
{":",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE}
|
||||
},
|
||||
{
|
||||
{Uri_HOST_DNS,S_OK,FALSE},
|
||||
{80,S_OK,FALSE},
|
||||
{URL_SCHEME_HTTP,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
},
|
||||
/* '@' is included because it's an unknown scheme type. */
|
||||
{ "zip://@gov.uk", 0, S_OK, FALSE,
|
||||
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
|
||||
Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|
|
||||
Uri_HAS_USER_INFO|Uri_HAS_USER_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
|
||||
FALSE,
|
||||
{
|
||||
{"zip://@gov.uk/",S_OK,FALSE},
|
||||
{"@gov.uk",S_OK,FALSE},
|
||||
{"zip://@gov.uk/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"gov.uk",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"zip://@gov.uk",S_OK,FALSE},
|
||||
{"zip",S_OK,FALSE},
|
||||
{"",S_OK,FALSE},
|
||||
{"",S_OK,FALSE}
|
||||
},
|
||||
{
|
||||
{Uri_HOST_DNS,S_OK,FALSE},
|
||||
{0,S_FALSE,FALSE},
|
||||
{URL_SCHEME_UNKNOWN,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
},
|
||||
/* ":@" are included because it's an unknown scheme type. */
|
||||
{ "zip://:@gov.uk", 0, S_OK, FALSE,
|
||||
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_HOST|
|
||||
Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|
|
||||
Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,
|
||||
FALSE,
|
||||
{
|
||||
{"zip://:@gov.uk/",S_OK,FALSE},
|
||||
{":@gov.uk",S_OK,FALSE},
|
||||
{"zip://:@gov.uk/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"gov.uk",S_OK,FALSE},
|
||||
{"",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"/",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE},
|
||||
{"zip://:@gov.uk",S_OK,FALSE},
|
||||
{"zip",S_OK,FALSE},
|
||||
{":",S_OK,FALSE},
|
||||
{"",S_FALSE,FALSE}
|
||||
},
|
||||
{
|
||||
{Uri_HOST_DNS,S_OK,FALSE},
|
||||
{0,S_FALSE,FALSE},
|
||||
{URL_SCHEME_UNKNOWN,S_OK,FALSE},
|
||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5188,13 +5340,15 @@ static void test_IUri_GetStrProperties(void) {
|
|||
hr, prop.expected, i);
|
||||
}
|
||||
todo_wine {
|
||||
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
|
||||
ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
|
||||
"Error: Expected %s but got %s on uri_tests[%d].\n",
|
||||
prop.value, wine_dbgstr_w(received), i);
|
||||
}
|
||||
} else {
|
||||
ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
|
||||
hr, prop.expected, i);
|
||||
ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
|
||||
ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
|
||||
"Error: Expected %s but got %s on uri_tests[%d].\n",
|
||||
prop.value, wine_dbgstr_w(received), i);
|
||||
}
|
||||
SysFreeString(received);
|
||||
|
|
|
@ -3427,8 +3427,36 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
|
|||
*pbstrProperty = SysAllocStringLen(NULL, 0);
|
||||
hres = S_FALSE;
|
||||
} else {
|
||||
*pbstrProperty = SysAllocString(This->canon_uri);
|
||||
hres = S_OK;
|
||||
if(This->scheme_type != URL_SCHEME_UNKNOWN && This->userinfo_start > -1) {
|
||||
if(This->userinfo_len == 0) {
|
||||
/* Don't include the '@' after the userinfo component. */
|
||||
*pbstrProperty = SysAllocStringLen(NULL, This->canon_len-1);
|
||||
hres = S_OK;
|
||||
if(*pbstrProperty) {
|
||||
/* Copy everything before it. */
|
||||
memcpy(*pbstrProperty, This->canon_uri, This->userinfo_start*sizeof(WCHAR));
|
||||
|
||||
/* And everything after it. */
|
||||
memcpy(*pbstrProperty+This->userinfo_start, This->canon_uri+This->userinfo_start+1,
|
||||
(This->canon_len-This->userinfo_start-1)*sizeof(WCHAR));
|
||||
}
|
||||
} else if(This->userinfo_split == 0 && This->userinfo_len == 1) {
|
||||
/* Don't include the ":@" */
|
||||
*pbstrProperty = SysAllocStringLen(NULL, This->canon_len-2);
|
||||
hres = S_OK;
|
||||
if(*pbstrProperty) {
|
||||
memcpy(*pbstrProperty, This->canon_uri, This->userinfo_start*sizeof(WCHAR));
|
||||
memcpy(*pbstrProperty+This->userinfo_start, This->canon_uri+This->userinfo_start+2,
|
||||
(This->canon_len-This->userinfo_start-2)*sizeof(WCHAR));
|
||||
}
|
||||
} else {
|
||||
*pbstrProperty = SysAllocString(This->canon_uri);
|
||||
hres = S_OK;
|
||||
}
|
||||
} else {
|
||||
*pbstrProperty = SysAllocString(This->canon_uri);
|
||||
hres = S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(!(*pbstrProperty))
|
||||
|
@ -3622,7 +3650,7 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
|
|||
|
||||
break;
|
||||
case Uri_PROPERTY_USER_NAME:
|
||||
if(This->userinfo_start > -1) {
|
||||
if(This->userinfo_start > -1 && This->userinfo_split != 0) {
|
||||
/* If userinfo_split is set, that means a password exists
|
||||
* so the username is only from userinfo_start to userinfo_split.
|
||||
*/
|
||||
|
@ -3675,7 +3703,19 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
|
|||
*pcchProperty = 0;
|
||||
hres = S_FALSE;
|
||||
} else {
|
||||
*pcchProperty = This->canon_len;
|
||||
if(This->scheme_type != URL_SCHEME_UNKNOWN) {
|
||||
if(This->userinfo_start > -1 && This->userinfo_len == 0)
|
||||
/* Don't include the '@' in the length. */
|
||||
*pcchProperty = This->canon_len-1;
|
||||
else if(This->userinfo_start > -1 && This->userinfo_len == 1 &&
|
||||
This->userinfo_split == 0)
|
||||
/* Don't include the ":@" in the length. */
|
||||
*pcchProperty = This->canon_len-2;
|
||||
else
|
||||
*pcchProperty = This->canon_len;
|
||||
} else
|
||||
*pcchProperty = This->canon_len;
|
||||
|
||||
hres = S_OK;
|
||||
}
|
||||
|
||||
|
@ -3753,7 +3793,10 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
|
|||
break;
|
||||
case Uri_PROPERTY_USER_NAME:
|
||||
*pcchProperty = (This->userinfo_split > -1) ? This->userinfo_split : This->userinfo_len;
|
||||
hres = (This->userinfo_start > -1) ? S_OK : S_FALSE;
|
||||
if(This->userinfo_split == 0)
|
||||
hres = S_FALSE;
|
||||
else
|
||||
hres = (This->userinfo_start > -1) ? S_OK : S_FALSE;
|
||||
break;
|
||||
default:
|
||||
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
|
||||
|
@ -3864,9 +3907,14 @@ static HRESULT WINAPI Uri_HasProperty(IUri *iface, Uri_PROPERTY uriProp, BOOL *p
|
|||
*pfHasProperty = This->scheme_start > -1;
|
||||
break;
|
||||
case Uri_PROPERTY_USER_INFO:
|
||||
case Uri_PROPERTY_USER_NAME:
|
||||
*pfHasProperty = This->userinfo_start > -1;
|
||||
break;
|
||||
case Uri_PROPERTY_USER_NAME:
|
||||
if(This->userinfo_split == 0)
|
||||
*pfHasProperty = FALSE;
|
||||
else
|
||||
*pfHasProperty = This->userinfo_start > -1;
|
||||
break;
|
||||
case Uri_PROPERTY_HOST_TYPE:
|
||||
*pfHasProperty = TRUE;
|
||||
break;
|
||||
|
@ -4021,8 +4069,11 @@ static HRESULT WINAPI Uri_GetProperties(IUri *iface, DWORD *pdwProperties)
|
|||
|
||||
if(This->authority_start > -1) {
|
||||
*pdwProperties |= Uri_HAS_AUTHORITY;
|
||||
if(This->userinfo_start > -1)
|
||||
*pdwProperties |= Uri_HAS_USER_INFO|Uri_HAS_USER_NAME;
|
||||
if(This->userinfo_start > -1) {
|
||||
*pdwProperties |= Uri_HAS_USER_INFO;
|
||||
if(This->userinfo_split != 0)
|
||||
*pdwProperties |= Uri_HAS_USER_NAME;
|
||||
}
|
||||
if(This->userinfo_split > -1)
|
||||
*pdwProperties |= Uri_HAS_PASSWORD;
|
||||
if(This->host_start > -1)
|
||||
|
|
Loading…
Reference in New Issue