Commit 1de7771a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Don't threat '#' as path delimiter in file URIs.

parent de9f19df
......@@ -385,6 +385,31 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
{
{"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
{"",S_FALSE},
{"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
{"",S_FALSE},
{".txt#hash%20part",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"/z:/test%20dir/README.txt#hash%20part",S_OK},
{"/z:/test%20dir/README.txt#hash%20part",S_OK},
{"",S_FALSE},
{"file:///z:/test dir/README.txt#hash part",S_OK},
{"file",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "urn:nothing:should:happen here", 0, S_OK, FALSE,
{
{"urn:nothing:should:happen here",S_OK,FALSE},
......@@ -587,6 +612,81 @@ static const uri_properties uri_tests[] = {
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "C:/test/test.mp3#fragment|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
{
{"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{".mp3#fragment|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
{"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"C:/test/test.mp3#fragment|part",S_OK,FALSE},
{"file",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "C:/test/test.mp3?query|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
{
{"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{".mp3",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"C:\\test\\test.mp3",S_OK,FALSE},
{"C:\\test\\test.mp3?query|part",S_OK,FALSE},
{"?query|part",S_OK,FALSE},
{"C:/test/test.mp3?query|part",S_OK,FALSE},
{"file",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "C:/test/test.mp3?query|part#hash|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
{
{"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{".mp3",S_OK,FALSE},
{"#hash|part",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE},
{"C:\\test\\test.mp3",S_OK,FALSE},
{"C:\\test\\test.mp3?query|part",S_OK,FALSE},
{"?query|part",S_OK,FALSE},
{"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
{"file",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
},
{ "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
{
{"*:www.winehq.org/test",S_OK,FALSE},
......@@ -11137,6 +11237,14 @@ static const create_urlmon_test_t create_urlmon_tests[] = {
"file:///c:/dir/file.txt",
"file:///c:/dir/file.txt",
"file:///c:/dir/file.txt",
},
{
"c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
NULL,0,
"file://c:\\dir\\file.txt#frag|part",
"file:///c:/dir/file.txt#frag%7Cpart",
"file:///c:/dir/file.txt#frag%7Cpart",
"file:///c:/dir/file.txt#frag%7Cpart",
}
};
......
......@@ -348,8 +348,8 @@ static inline BOOL is_hexdigit(WCHAR val) {
(val >= '0' && val <= '9'));
}
static inline BOOL is_path_delim(WCHAR val) {
return (!val || val == '#' || val == '?');
static inline BOOL is_path_delim(URL_SCHEME scheme, WCHAR val) {
return (!val || (val == '#' && scheme != URL_SCHEME_FILE) || val == '?');
}
static inline BOOL is_slash(WCHAR c)
......@@ -1842,7 +1842,7 @@ static BOOL parse_path_hierarchical(const WCHAR **ptr, parse_data *data, DWORD f
static const WCHAR slash[] = {'/',0};
const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
if(is_path_delim(**ptr)) {
if(is_path_delim(data->scheme_type, **ptr)) {
if(data->scheme_type == URL_SCHEME_WILDCARD && !data->must_have_path) {
data->path = NULL;
data->path_len = 0;
......@@ -1852,7 +1852,7 @@ static BOOL parse_path_hierarchical(const WCHAR **ptr, parse_data *data, DWORD f
data->path_len = 1;
}
} else {
while(!is_path_delim(**ptr)) {
while(!is_path_delim(data->scheme_type, **ptr)) {
if(**ptr == '%' && data->scheme_type != URL_SCHEME_UNKNOWN && !is_file) {
if(!check_pct_encoded(ptr)) {
*ptr = start;
......@@ -1927,7 +1927,7 @@ static BOOL parse_path_opaque(const WCHAR **ptr, parse_data *data, DWORD flags)
else
data->path = *ptr;
while(!is_path_delim(**ptr)) {
while(!is_path_delim(data->scheme_type, **ptr)) {
if(**ptr == '%' && known_scheme) {
if(!check_pct_encoded(ptr)) {
*ptr = data->path;
......
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