diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 877250debb6..5ff8ff583b2 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -3572,6 +3572,61 @@ static const uri_properties uri_tests[] = { {URL_SCHEME_FILE,S_OK,FALSE}, {URLZONE_INVALID,E_NOTIMPL,FALSE} } + }, + /* Doesn't have an absolute since it's opaque, but gets it port set. */ + { "http:test.com/index.html", 0, S_OK, FALSE, + Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY + |Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"http:test.com/index.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"test.com/index.html",S_OK,FALSE}, + {"test.com/index.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"http:test.com/index.html",S_OK,FALSE}, + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + { "ftp:test.com/index.html", 0, S_OK, FALSE, + Uri_HAS_DISPLAY_URI|Uri_HAS_EXTENSION|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY + |Uri_HAS_RAW_URI|Uri_HAS_SCHEME_NAME|Uri_HAS_HOST_TYPE|Uri_HAS_PORT|Uri_HAS_SCHEME, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp:test.com/index.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"test.com/index.html",S_OK,FALSE}, + {"test.com/index.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp:test.com/index.html",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {21,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } } }; diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index ad6d284a251..49b64c878c7 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -2841,12 +2841,24 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags, uri->authority_len = 0; uri->domain_offset = -1; - if(is_hierarchical_scheme(data->scheme_type)) + if(is_hierarchical_scheme(data->scheme_type)) { + DWORD i; + /* Absolute URIs aren't displayed for known scheme types * which should be hierarchical URIs. */ uri->display_absolute = FALSE; + /* Windows also sets the port for these (if they have one). */ + for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) { + if(data->scheme_type == default_ports[i].scheme) { + uri->has_port = TRUE; + uri->port = default_ports[i].port; + break; + } + } + } + if(!canonicalize_path_opaque(data, uri, flags, computeOnly)) return FALSE; } @@ -3817,10 +3829,10 @@ static HRESULT WINAPI Uri_GetProperties(IUri *iface, DWORD *pdwProperties) *pdwProperties |= Uri_HAS_HOST; if(This->domain_offset > -1) *pdwProperties |= Uri_HAS_DOMAIN; - if(This->has_port) - *pdwProperties |= Uri_HAS_PORT; } + if(This->has_port) + *pdwProperties |= Uri_HAS_PORT; if(This->path_start > -1) *pdwProperties |= Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY; if(This->query_start > -1)