Module: wine Branch: master Commit: 1aa9389eaf2fab4b67483e77021f635ee13e987d URL: http://source.winehq.org/git/wine.git/?a=commit;h=1aa9389eaf2fab4b67483e7702...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Jan 31 11:42:44 2012 +0100
urlmon: Relative URI without scheme may be treated as hierarchical.
---
dlls/urlmon/tests/uri.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/urlmon/uri.c | 4 +- 2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 9a27e59..9d9487a 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -4421,6 +4421,81 @@ static const uri_properties uri_tests[] = { {URLZONE_INVALID,E_NOTIMPL} } }, + { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE, + { + {"//host.com/path/file.txt?query",S_OK}, + {"host.com",S_OK}, + {"//host.com/path/file.txt?query",S_OK}, + {"host.com",S_OK}, + {".txt",S_OK}, + {"",S_FALSE}, + {"host.com",S_OK}, + {"",S_FALSE}, + {"/path/file.txt",S_OK}, + {"/path/file.txt?query",S_OK}, + {"?query",S_OK}, + {"//host.com/path/file.txt?query",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + }, + { + {Uri_HOST_DNS,S_OK}, + {0,S_FALSE}, + {URL_SCHEME_UNKNOWN,S_OK}, + {URLZONE_INVALID,E_NOTIMPL} + } + }, + { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE, + { + {"//host/path/file.txt?query",S_OK}, + {"host",S_OK}, + {"//host/path/file.txt?query",S_OK}, + {"",S_FALSE}, + {".txt",S_OK}, + {"",S_FALSE}, + {"host",S_OK}, + {"",S_FALSE}, + {"/path/file.txt",S_OK}, + {"/path/file.txt?query",S_OK}, + {"?query",S_OK}, + {"//host/path/file.txt?query",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + }, + { + {Uri_HOST_DNS,S_OK}, + {0,S_FALSE}, + {URL_SCHEME_UNKNOWN,S_OK}, + {URLZONE_INVALID,E_NOTIMPL} + } + }, + { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE, + { + {"//host/",S_OK}, + {"host",S_OK}, + {"//host/",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + {"host",S_OK}, + {"",S_FALSE}, + {"/",S_OK}, + {"/",S_OK}, + {"",S_FALSE}, + {"//host",S_OK}, + {"",S_FALSE}, + {"",S_FALSE}, + {"",S_FALSE}, + }, + { + {Uri_HOST_DNS,S_OK}, + {0,S_FALSE}, + {URL_SCHEME_UNKNOWN,S_OK}, + {URLZONE_INVALID,E_NOTIMPL} + } + } };
typedef struct _invalid_uri { diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 4cefaa0..653e22c 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -410,7 +410,7 @@ static void apply_default_flags(DWORD *flags) { * B.) It's an implicit file scheme. * C.) It's a known hierarchical scheme and it has two '\' after the scheme name. * (the '\' will be converted into "//" during canonicalization). - * D.) It's not a relative URI and "//" appears after the scheme name. + * D.) "//" appears after the scheme name (or at the beginning if no scheme is given). */ static inline BOOL is_hierarchical_uri(const WCHAR **ptr, const parse_data *data) { const WCHAR *start = *ptr; @@ -422,7 +422,7 @@ static inline BOOL is_hierarchical_uri(const WCHAR **ptr, const parse_data *data else if(is_hierarchical_scheme(data->scheme_type) && (*ptr)[0] == '\' && (*ptr)[1] == '\') { *ptr += 2; return TRUE; - } else if(!data->is_relative && check_hierarchical(ptr)) + } else if(check_hierarchical(ptr)) return TRUE;
*ptr = start;