urlmon: Fix handling of mailto URIs in CoInternetCombineUrlEx.

Jacek Caban jacek at codeweavers.com
Wed Mar 27 04:59:11 CDT 2013


Hi Hans,

On 03/27/13 10:43, Hans Leidekker wrote:
> ---
>  dlls/urlmon/tests/uri.c |   63 +++++++++++++++++++++++++++++++++++++++++++----
>  dlls/urlmon/uri.c       |   15 ++++++++---
>  2 files changed, 69 insertions(+), 9 deletions(-)
>
> diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
> index e5faa81..29bd859 100644
> --- a/dlls/urlmon/tests/uri.c
> +++ b/dlls/urlmon/tests/uri.c
> @@ -7005,8 +7005,61 @@ static const uri_combine_test uri_combine_tests[] = {
>              {URL_SCHEME_FILE,S_OK},
>              {URLZONE_INVALID,E_NOTIMPL}
>          }
> +    },
> +    {   "http://winehq.org",0,
> +        "mailto://",0,
> +        0,S_OK,FALSE,

You are changing parts that are not combining-specific. Since the
relative URI is absolute in this case, there is not much happening other
than parsing the URI during combining. Those tests are fine, but please
add also tests for CreateUri, see uri_tests array. This should be
straightforward based on tests you already wrote.

> diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
> index 0f6ee31..c6b5166 100644
> --- a/dlls/urlmon/uri.c
> +++ b/dlls/urlmon/uri.c
> @@ -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(check_hierarchical(ptr))
> +    } else if(data->scheme_type != URL_SCHEME_MAILTO && check_hierarchical(ptr))
>          return TRUE;
>  
>      *ptr = start;
> @@ -2980,6 +2980,9 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
>      const BOOL known_scheme = data->scheme_type != URL_SCHEME_UNKNOWN;
>      const BOOL is_file = data->scheme_type == URL_SCHEME_FILE;
>      const BOOL is_mk = data->scheme_type == URL_SCHEME_MK;
> +    const BOOL is_javascript = data->scheme_type == URL_SCHEME_JAVASCRIPT;
> +    const BOOL is_mailto = data->scheme_type == URL_SCHEME_MAILTO;
> +    DWORD offset = 0;
>  
>      if(!data->path) {
>          uri->path_start = -1;
> @@ -2996,7 +2999,7 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
>      }
>  
>      /* For javascript: URIs, simply copy path part without any canonicalization */
> -    if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
> +    if(is_javascript) {
>          if(!computeOnly)
>              memcpy(uri->canon_uri+uri->canon_len, data->path, data->path_len*sizeof(WCHAR));
>          uri->path_len = data->path_len;
> @@ -3007,7 +3010,11 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla
>      /* Windows doesn't allow a "//" to appear after the scheme
>       * of a URI, if it's an opaque URI.
>       */
> -    if(data->scheme && *(data->path) == '/' && *(data->path+1) == '/') {
> +    if (is_mailto && *(data->path) == '/' && *(data->path+1) == '/') {
> +        if (!*(data->path+2)) uri->path_start = -1;
> +        offset += 2;

I think this should be done in parsing phrase, not during canonicalization.


Jacek



More information about the wine-devel mailing list