urlmon: Improved IUri support for wildcard URLs.
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index d08dd5b..3483878 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -4291,6 +4291,31 @@
{URL_SCHEME_JAVASCRIPT,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
+ },
+ { "*://google.com", 0, S_OK, FALSE,
+ {
+ {"*:google.com/",S_OK,FALSE},
+ {"google.com",S_OK},
+ {"*:google.com/",S_OK,FALSE},
+ {"google.com",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"",S_FALSE,FALSE},
+ {"google.com",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"/",S_OK,FALSE},
+ {"/",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"*://google.com",S_OK,FALSE},
+ {"*",S_OK,FALSE},
+ {"",S_FALSE,FALSE},
+ {"",S_FALSE,FALSE}
+ },
+ {
+ {Uri_HOST_DNS,S_OK,FALSE},
+ {0,S_FALSE,FALSE},
+ {URL_SCHEME_WILDCARD,S_OK,FALSE},
+ {URLZONE_INVALID,E_NOTIMPL,FALSE}
+ }
}
};
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index 5dfa8b8..2b0b9ad 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -155,6 +155,7 @@
BOOL has_implicit_scheme;
BOOL has_implicit_ip;
UINT implicit_ipv4;
+ BOOL must_have_path;
const WCHAR *scheme;
DWORD scheme_len;
@@ -1938,10 +1939,7 @@
const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
if(is_path_delim(**ptr)) {
- if(data->scheme_type == URL_SCHEME_WILDCARD) {
- /* Wildcard schemes don't get a '/' attached if their path is
- * empty.
- */
+ if(data->scheme_type == URL_SCHEME_WILDCARD && !data->must_have_path) {
data->path = NULL;
data->path_len = 0;
} else if(!(flags & Uri_CREATE_NO_CANONICALIZE)) {
@@ -2068,6 +2066,8 @@
static BOOL parse_hierpart(const WCHAR **ptr, parse_data *data, DWORD flags) {
const WCHAR *start = *ptr;
+ data->must_have_path = FALSE;
+
/* For javascript: URIs, simply set everything as a path */
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
data->path = *ptr;
@@ -2087,6 +2087,13 @@
TRACE("(%p %p %x): Treating URI as an hierarchical URI.\n", ptr, data, flags);
data->is_opaque = FALSE;
+ if(data->scheme_type == URL_SCHEME_WILDCARD && !data->has_implicit_scheme) {
+ if(**ptr == '/' && *(*ptr+1) == '/') {
+ data->must_have_path = TRUE;
+ *ptr += 2;
+ }
+ }
+
/* TODO: Handle hierarchical URI's, parse authority then parse the path. */
if(!parse_authority(ptr, data, flags))
return FALSE;
@@ -3184,6 +3191,9 @@
*/
if((data->is_relative && (data->host || data->has_port)) ||
(!data->is_relative && data->scheme_type != URL_SCHEME_WILDCARD)) {
+ if(data->scheme_type == URL_SCHEME_WILDCARD)
+ FIXME("Here\n");
+
if(!computeOnly) {
INT pos = uri->canon_len;