urlmon: Fixed the scheme name parser to handle wildcard schemes.

This commit is contained in:
Thomas Mullaly 2010-07-21 23:56:36 -04:00 committed by Alexandre Julliard
parent 6c970e7e66
commit 0d0078380e
2 changed files with 91 additions and 1 deletions

View File

@ -684,6 +684,90 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE} {URLZONE_INVALID,E_NOTIMPL,FALSE}
} }
}, },
/* Valid since the '*' is the only character in the scheme name. */
{ "*:www.winehq.org/test", 0, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_DOMAIN|Uri_HAS_HOST|
Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|
Uri_HAS_SCHEME,
TRUE,
{
{"*:www.winehq.org/test",S_OK,TRUE},
{"www.winehq.org",S_OK,TRUE},
{"*:www.winehq.org/test",S_OK,TRUE},
{"winehq.org",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
{"www.winehq.org",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"/test",S_OK,TRUE},
{"/test",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"*:www.winehq.org/test",S_OK,FALSE},
{"*",S_OK,FALSE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
},
{
{Uri_HOST_DNS,S_OK,TRUE},
{0,S_FALSE,TRUE},
{URL_SCHEME_WILDCARD,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
/* Not valid since a '*' is only allowed to appear if its the only character in scheme. */
{ "*abcd://not.valid.com", 0, E_INVALIDARG, FALSE,
0, TRUE,
{
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_FALSE,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_INVALID,S_FALSE,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
/* Not valid since a '*' is only allowed to appear if its the only character in scheme. */
{ "*a*b*c*d://not.valid.com", 0, E_INVALIDARG, FALSE,
0, TRUE,
{
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_FALSE,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_INVALID,S_FALSE,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE, { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH| Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|
Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME, Uri_HAS_PATH_AND_QUERY|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|Uri_HAS_SCHEME,

View File

@ -116,7 +116,13 @@ static BOOL parse_scheme_name(const WCHAR **ptr, parse_data *data) {
data->scheme_len = 0; data->scheme_len = 0;
while(**ptr) { while(**ptr) {
if(!is_num(**ptr) && !is_alpha(**ptr) && **ptr != '+' && if(**ptr == '*' && *ptr == start) {
/* Might have found a wildcard scheme. If it is the next
* char has to be a ':' for it to be a valid URI
*/
++(*ptr);
break;
} else if(!is_num(**ptr) && !is_alpha(**ptr) && **ptr != '+' &&
**ptr != '-' && **ptr != '.') **ptr != '-' && **ptr != '.')
break; break;