Commit d6e624c7 authored by Thomas Mullaly's avatar Thomas Mullaly Committed by Alexandre Julliard

urlmon: Improved IUri support for file URIs.

parent 03efc237
...@@ -4295,6 +4295,35 @@ static const uri_properties uri_tests[] = { ...@@ -4295,6 +4295,35 @@ static const uri_properties uri_tests[] = {
{URL_SCHEME_MK,S_OK,FALSE}, {URL_SCHEME_MK,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE} {URLZONE_INVALID,E_NOTIMPL,FALSE}
} }
},
/* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
{ "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
Uri_HAS_ABSOLUTE_URI|Uri_HAS_AUTHORITY|Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|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, FALSE,
{
{"file://\\\\server\\dir\\index.html",S_OK,FALSE},
{"server",S_OK,FALSE},
{"file://\\\\server\\dir\\index.html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{".html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"server",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"\\dir\\index.html",S_OK,FALSE},
{"\\dir\\index.html",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"file://server/dir/index.html",S_OK,FALSE},
{"file",S_OK,FALSE},
{"",S_FALSE,FALSE},
{"",S_FALSE,FALSE}
},
{
{Uri_HOST_DNS,S_OK,FALSE},
{0,S_FALSE,FALSE},
{URL_SCHEME_FILE,S_OK,FALSE},
{URLZONE_INVALID,E_NOTIMPL,FALSE}
}
} }
}; };
......
...@@ -2348,6 +2348,9 @@ static BOOL canonicalize_userinfo(const parse_data *data, Uri *uri, DWORD flags, ...@@ -2348,6 +2348,9 @@ static BOOL canonicalize_userinfo(const parse_data *data, Uri *uri, DWORD flags,
* it isn't an unknown scheme type. * it isn't an unknown scheme type.
* *
* 4) If it's a file scheme and the host is "localhost" it's removed. * 4) If it's a file scheme and the host is "localhost" it's removed.
*
* 5) If it's a file scheme and Uri_CREATE_FILE_USE_DOS_PATH is set,
* then the UNC path characters are added before the host name.
*/ */
static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri, static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
DWORD flags, BOOL computeOnly) { DWORD flags, BOOL computeOnly) {
...@@ -2356,8 +2359,6 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri, ...@@ -2356,8 +2359,6 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
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;
uri->host_start = uri->canon_len;
if(data->scheme_type == URL_SCHEME_FILE && if(data->scheme_type == URL_SCHEME_FILE &&
data->host_len == lstrlenW(localhostW)) { data->host_len == lstrlenW(localhostW)) {
if(!StrCmpNIW(data->host, localhostW, data->host_len)) { if(!StrCmpNIW(data->host, localhostW, data->host_len)) {
...@@ -2368,6 +2369,17 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri, ...@@ -2368,6 +2369,17 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
} }
} }
if(data->scheme_type == URL_SCHEME_FILE && flags & Uri_CREATE_FILE_USE_DOS_PATH) {
if(!computeOnly) {
uri->canon_uri[uri->canon_len] = '\\';
uri->canon_uri[uri->canon_len+1] = '\\';
}
uri->canon_len += 2;
uri->authority_start = uri->canon_len;
}
uri->host_start = uri->canon_len;
for(ptr = data->host; ptr < data->host+data->host_len; ++ptr) { for(ptr = data->host; ptr < data->host+data->host_len; ++ptr) {
if(*ptr == '%' && known_scheme) { if(*ptr == '%' && known_scheme) {
WCHAR val = decode_pct_val(ptr); WCHAR val = decode_pct_val(ptr);
......
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