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

urlmon: Implemented base case for CoInternetCombineIUri.

parent 2d61633e
......@@ -5578,7 +5578,7 @@ static const uri_combine_test uri_combine_tests[] = {
},
{ "http://google.com/test",0,
"zip://test.com/cool",0,
0,S_OK,TRUE,
0,S_OK,FALSE,
{
{"zip://test.com/cool",S_OK},
{"test.com",S_OK},
......@@ -5899,6 +5899,95 @@ static const uri_combine_test uri_combine_tests[] = {
{URL_SCHEME_FILE,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
},
/* URL_DONT_SIMPLIFY has no effect. */
{ "http://google.com/test",0,
"zip://test.com/cool/../cool/test",0,
URL_DONT_SIMPLIFY,S_OK,FALSE,
{
{"zip://test.com/cool/test",S_OK},
{"test.com",S_OK},
{"zip://test.com/cool/test",S_OK},
{"test.com",S_OK},
{"",S_FALSE},
{"",S_FALSE},
{"test.com",S_OK},
{"",S_FALSE},
{"/cool/test",S_OK},
{"/cool/test",S_OK},
{"",S_FALSE},
/* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
* On IE 7 it reduces the path in the Raw URI.
*/
{"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
{"zip",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_DNS,S_OK},
{0,S_FALSE},
{URL_SCHEME_UNKNOWN,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
},
/* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
* resulting URI is converted into a dos path.
*/
{ "http://google.com/test",0,
"file:///c:/test/",0,
URL_FILE_USE_PATHURL,S_OK,FALSE,
{
{"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
{"",S_FALSE},
{"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"",S_FALSE},
{"/c:/test/",S_OK,FALSE,"c:\\test\\"},
{"/c:/test/",S_OK,FALSE,"c:\\test\\"},
{"",S_FALSE},
{"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
{"file",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_UNKNOWN,S_OK},
{0,S_FALSE},
{URL_SCHEME_FILE,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
},
{ "http://google.com/test",0,
"http://test.com/test#%30test",0,
URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
{
{"http://test.com/test#0test",S_OK},
{"test.com",S_OK},
{"http://test.com/test#0test",S_OK},
{"test.com",S_OK},
{"",S_FALSE},
{"#0test",S_OK},
{"test.com",S_OK},
{"",S_FALSE},
{"/test",S_OK},
{"/test",S_OK},
{"",S_FALSE},
/* IE 7 decodes the %30 to a 0 in the Raw URI. */
{"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
{"http",S_OK},
{"",S_FALSE},
{"",S_FALSE}
},
{
{Uri_HOST_DNS,S_OK},
{80,S_OK},
{URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
}
};
......@@ -9072,7 +9161,8 @@ static void test_CoInternetCombineIUri(void) {
hr, prop.expected, i, j);
}
todo_wine {
ok(!strcmp_aw(prop.value, received),
ok(!strcmp_aw(prop.value, received) ||
broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
"Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
prop.value, wine_dbgstr_w(received), i, j);
}
......@@ -9080,7 +9170,8 @@ static void test_CoInternetCombineIUri(void) {
ok(hr == prop.expected,
"Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
hr, prop.expected, i, j);
ok(!strcmp_aw(prop.value, received),
ok(!strcmp_aw(prop.value, received) ||
broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
"Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
prop.value, wine_dbgstr_w(received), i, j);
}
......
......@@ -5589,12 +5589,63 @@ HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserve
return S_OK;
}
static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result) {
Uri *ret;
HRESULT hr;
parse_data data;
/* Base case is when the relative Uri has a scheme name,
* if it does, then 'result' will contain the same data
* as the relative Uri.
*/
if(relative->scheme_start > -1) {
DWORD create_flags = 0;
memset(&data, 0, sizeof(parse_data));
data.uri = SysAllocString(relative->raw_uri);
if(!data.uri) {
IUri_Release(URI(ret));
*result = NULL;
return E_OUTOFMEMORY;
}
parse_uri(&data, 0);
ret = create_uri_obj();
if(!ret) {
*result = NULL;
return E_OUTOFMEMORY;
}
ret->raw_uri = data.uri;
hr = canonicalize_uri(&data, ret, 0);
if(FAILED(hr)) {
IUri_Release(URI(ret));
*result = NULL;
return hr;
}
apply_default_flags(&create_flags);
ret->create_flags = create_flags;
*result = URI(ret);
} else {
*result = NULL;
return E_NOTIMPL;
}
return S_OK;
}
/***********************************************************************
* CoInternetCombineIUri (urlmon.@)
*/
HRESULT WINAPI CoInternetCombineIUri(IUri *pBaseUri, IUri *pRelativeUri, DWORD dwCombineFlags,
IUri **ppCombinedUri, DWORD_PTR dwReserved)
{
HRESULT hr;
Uri *relative, *base;
TRACE("(%p %p %x %p %x)\n", pBaseUri, pRelativeUri, dwCombineFlags, ppCombinedUri, (DWORD)dwReserved);
if(!ppCombinedUri)
......@@ -5605,6 +5656,17 @@ HRESULT WINAPI CoInternetCombineIUri(IUri *pBaseUri, IUri *pRelativeUri, DWORD d
return E_INVALIDARG;
}
FIXME("(%p %p %x %p %x): stub\n", pBaseUri, pRelativeUri, dwCombineFlags, ppCombinedUri, (DWORD)dwReserved);
return E_NOTIMPL;
relative = get_uri_obj(pRelativeUri);
base = get_uri_obj(pBaseUri);
if(!relative || !base) {
*ppCombinedUri = NULL;
FIXME("(%p %p %x %p %x) Unknown IUri types not supported yet.\n",
pBaseUri, pRelativeUri, dwCombineFlags, ppCombinedUri, (DWORD)dwReserved);
return E_NOTIMPL;
}
hr = combine_uri(base, relative, dwCombineFlags, ppCombinedUri);
if(hr == E_NOTIMPL)
FIXME("(%p %p %x %p %x): stub\n", pBaseUri, pRelativeUri, dwCombineFlags, ppCombinedUri, (DWORD)dwReserved);
return hr;
}
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