mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:50:21 +00:00
urlmon: Improve parsing of SCHEME_MK URIs.
This commit is contained in:
parent
8f5543c34e
commit
31853fc203
|
@ -4316,7 +4316,32 @@ static const uri_properties uri_tests[] = {
|
||||||
{URL_SCHEME_WILDCARD,S_OK,FALSE},
|
{URL_SCHEME_WILDCARD,S_OK,FALSE},
|
||||||
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
{URLZONE_INVALID,E_NOTIMPL,FALSE}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{ "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{".txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
|
||||||
|
{"mk",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_UNKNOWN,S_OK},
|
||||||
|
{0,S_FALSE},
|
||||||
|
{URL_SCHEME_MK,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _invalid_uri {
|
typedef struct _invalid_uri {
|
||||||
|
@ -6336,6 +6361,87 @@ static const uri_combine_test uri_combine_tests[] = {
|
||||||
{URL_SCHEME_HTTP,S_OK},
|
{URL_SCHEME_HTTP,S_OK},
|
||||||
{URLZONE_INVALID,E_NOTIMPL}
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{ "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
|
||||||
|
"relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
|
||||||
|
0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{".txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"mk",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_UNKNOWN,S_OK},
|
||||||
|
{0,S_FALSE},
|
||||||
|
{URL_SCHEME_MK,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
|
||||||
|
"relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
|
||||||
|
0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{".txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"mk",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_UNKNOWN,S_OK},
|
||||||
|
{0,S_FALSE},
|
||||||
|
{URL_SCHEME_MK,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
|
||||||
|
"relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
|
||||||
|
0,S_OK,FALSE,
|
||||||
|
{
|
||||||
|
{"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{".txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
|
||||||
|
{"mk",S_OK},
|
||||||
|
{"",S_FALSE},
|
||||||
|
{"",S_FALSE}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{Uri_HOST_UNKNOWN,S_OK},
|
||||||
|
{0,S_FALSE},
|
||||||
|
{URL_SCHEME_MK,S_OK},
|
||||||
|
{URLZONE_INVALID,E_NOTIMPL}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3086,6 +3086,7 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
const BOOL known_scheme = data->scheme_type != URL_SCHEME_UNKNOWN;
|
const BOOL known_scheme = data->scheme_type != URL_SCHEME_UNKNOWN;
|
||||||
const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
|
const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
|
||||||
|
const BOOL is_mk = data->scheme_type == URL_SCHEME_MK;
|
||||||
|
|
||||||
if(!data->path) {
|
if(!data->path) {
|
||||||
uri->path_start = -1;
|
uri->path_start = -1;
|
||||||
|
@ -3095,6 +3096,12 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
|
||||||
|
|
||||||
uri->path_start = uri->canon_len;
|
uri->path_start = uri->canon_len;
|
||||||
|
|
||||||
|
if(is_mk){
|
||||||
|
/* hijack this flag for SCHEME_MK to tell the function when to start
|
||||||
|
* converting slashes */
|
||||||
|
flags |= Uri_CREATE_FILE_USE_DOS_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
/* For javascript: URIs, simply copy path part without any canonicalization */
|
/* For javascript: URIs, simply copy path part without any canonicalization */
|
||||||
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
|
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
|
||||||
if(!computeOnly)
|
if(!computeOnly)
|
||||||
|
@ -3137,13 +3144,15 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
|
||||||
++uri->canon_len;
|
++uri->canon_len;
|
||||||
do_default_action = FALSE;
|
do_default_action = FALSE;
|
||||||
} else if(*ptr == '\\') {
|
} else if(*ptr == '\\') {
|
||||||
if(is_file && !(flags & Uri_CREATE_FILE_USE_DOS_PATH)) {
|
if((data->is_relative || is_mk || is_file) && !(flags & Uri_CREATE_FILE_USE_DOS_PATH)) {
|
||||||
/* Convert to a '/'. */
|
/* Convert to a '/'. */
|
||||||
if(!computeOnly)
|
if(!computeOnly)
|
||||||
uri->canon_uri[uri->canon_len] = '/';
|
uri->canon_uri[uri->canon_len] = '/';
|
||||||
++uri->canon_len;
|
++uri->canon_len;
|
||||||
do_default_action = FALSE;
|
do_default_action = FALSE;
|
||||||
}
|
}
|
||||||
|
} else if(is_mk && *ptr == ':' && ptr + 1 < data->path + data->path_len && *(ptr + 1) == ':') {
|
||||||
|
flags &= ~Uri_CREATE_FILE_USE_DOS_PATH;
|
||||||
} else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
|
} else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr) &&
|
||||||
!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS)) {
|
!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS)) {
|
||||||
if(!(is_file && (flags & Uri_CREATE_FILE_USE_DOS_PATH))) {
|
if(!(is_file && (flags & Uri_CREATE_FILE_USE_DOS_PATH))) {
|
||||||
|
@ -3161,7 +3170,7 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->scheme_type == URL_SCHEME_MK && !computeOnly && !(flags & Uri_CREATE_NO_CANONICALIZE)) {
|
if(is_mk && !computeOnly && !(flags & Uri_CREATE_NO_CANONICALIZE)) {
|
||||||
DWORD new_len = remove_dot_segments(uri->canon_uri + uri->path_start,
|
DWORD new_len = remove_dot_segments(uri->canon_uri + uri->path_start,
|
||||||
uri->canon_len - uri->path_start);
|
uri->canon_len - uri->path_start);
|
||||||
uri->canon_len = uri->path_start + new_len;
|
uri->canon_len = uri->path_start + new_len;
|
||||||
|
@ -5165,7 +5174,7 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
|
||||||
memset(&data, 0, sizeof(parse_data));
|
memset(&data, 0, sizeof(parse_data));
|
||||||
data.uri = ret->raw_uri;
|
data.uri = ret->raw_uri;
|
||||||
|
|
||||||
/* Validate and parse the URI into it's components. */
|
/* Validate and parse the URI into its components. */
|
||||||
if(!parse_uri(&data, dwFlags)) {
|
if(!parse_uri(&data, dwFlags)) {
|
||||||
/* Encountered an unsupported or invalid URI */
|
/* Encountered an unsupported or invalid URI */
|
||||||
IUri_Release(&ret->IUri_iface);
|
IUri_Release(&ret->IUri_iface);
|
||||||
|
|
Loading…
Reference in a new issue