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

urlmon: Implemented functionality for retrieving the RAW_URI property of a IUri.

parent 15f36468
......@@ -104,7 +104,7 @@ static const uri_properties uri_tests[] = {
{"/",S_OK,TRUE}, /* PATH */
{"/",S_OK,TRUE}, /* PATH_AND_QUERY */
{"",S_FALSE,TRUE}, /* QUERY */
{"http://www.winehq.org/tests/../tests/../..",S_OK,TRUE}, /* RAW_URI */
{"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
{"http",S_OK,TRUE}, /* SCHEME_NAME */
{"",S_FALSE,TRUE}, /* USER_INFO */
{"",S_FALSE,TRUE} /* USER_NAME */
......@@ -133,7 +133,7 @@ static const uri_properties uri_tests[] = {
{"/tests",S_OK,TRUE},
{"/tests",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"http://winehq.org/tests/.././tests",S_OK,TRUE},
{"http://winehq.org/tests/.././tests",S_OK,FALSE},
{"http",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -162,7 +162,7 @@ static const uri_properties uri_tests[] = {
{"/",S_OK,TRUE},
{"/?query=x&return=y",S_OK,TRUE},
{"?query=x&return=y",S_OK,TRUE},
{"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,TRUE},
{"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
{"http",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -191,7 +191,7 @@ static const uri_properties uri_tests[] = {
{"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
{"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,TRUE},
{"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
{"http",S_OK,TRUE},
{"usEr%3Ainfo",S_OK,TRUE},
{"usEr%3Ainfo",S_OK,TRUE}
......@@ -221,7 +221,7 @@ static const uri_properties uri_tests[] = {
{"/dir/foo%20bar.txt",S_OK,TRUE},
{"/dir/foo%20bar.txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,TRUE},
{"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
{"ftp",S_OK,TRUE},
{"winepass:wine",S_OK,TRUE},
{"winepass",S_OK,TRUE}
......@@ -249,7 +249,7 @@ static const uri_properties uri_tests[] = {
{"/c:/tests/foo%2520bar.mp3",S_OK,TRUE},
{"/c:/tests/foo%2520bar.mp3",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,TRUE},
{"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
{"file",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -277,7 +277,7 @@ static const uri_properties uri_tests[] = {
{"/tests/test%20file.README.txt",S_OK,TRUE},
{"/tests/test%20file.README.txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,TRUE},
{"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
{"file",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -305,7 +305,7 @@ static const uri_properties uri_tests[] = {
{"nothing:should:happen here",S_OK,TRUE},
{"nothing:should:happen here",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"urn:nothing:should:happen here",S_OK,TRUE},
{"urn:nothing:should:happen here",S_OK,FALSE},
{"urn",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -334,7 +334,7 @@ static const uri_properties uri_tests[] = {
{"/test%20dir/test.txt",S_OK,TRUE},
{"/test%20dir/test.txt",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,TRUE},
{"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
{"http",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -363,7 +363,7 @@ static const uri_properties uri_tests[] = {
{"/",S_OK,TRUE},
{"/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,TRUE},
{"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
{"http",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -392,7 +392,7 @@ static const uri_properties uri_tests[] = {
{"/",S_OK,TRUE},
{"/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"ftp://[::13.1.68.3]",S_OK,TRUE},
{"ftp://[::13.1.68.3]",S_OK,FALSE},
{"ftp",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE}
......@@ -421,7 +421,7 @@ static const uri_properties uri_tests[] = {
{"/",S_OK,TRUE},
{"/",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,TRUE},
{"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
{"http",S_OK,TRUE},
{"",S_FALSE,TRUE},
{"",S_FALSE,TRUE},
......
......@@ -25,6 +25,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
typedef struct {
const IUriVtbl *lpIUriVtbl;
LONG ref;
BSTR raw_uri;
} Uri;
typedef struct {
......@@ -74,8 +76,10 @@ static ULONG WINAPI Uri_Release(IUri *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
if(!ref) {
SysFreeString(This->raw_uri);
heap_free(This);
}
return ref;
}
......@@ -83,7 +87,8 @@ static ULONG WINAPI Uri_Release(IUri *iface)
static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BSTR *pbstrProperty, DWORD dwFlags)
{
Uri *This = URI_THIS(iface);
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
HRESULT hres;
TRACE("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
if(!pbstrProperty)
return E_POINTER;
......@@ -99,13 +104,33 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST
return S_OK;
}
/* Don't have support for flags yet. */
if(dwFlags) {
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
return E_NOTIMPL;
}
switch(uriProp) {
case Uri_PROPERTY_RAW_URI:
*pbstrProperty = SysAllocString(This->raw_uri);
if(!(*pbstrProperty))
hres = E_OUTOFMEMORY;
else
hres = S_OK;
break;
default:
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pbstrProperty, dwFlags);
hres = E_NOTIMPL;
}
return hres;
}
static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, DWORD *pcchProperty, DWORD dwFlags)
{
Uri *This = URI_THIS(iface);
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
HRESULT hres;
TRACE("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
if(!pcchProperty)
return E_INVALIDARG;
......@@ -114,7 +139,23 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D
if(uriProp > Uri_PROPERTY_STRING_LAST)
return E_INVALIDARG;
/* Don't have support for flags yet. */
if(dwFlags) {
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
return E_NOTIMPL;
}
switch(uriProp) {
case Uri_PROPERTY_RAW_URI:
*pcchProperty = SysStringLen(This->raw_uri);
hres = S_OK;
break;
default:
FIXME("(%p)->(%d %p %x)\n", This, uriProp, pcchProperty, dwFlags);
hres = E_NOTIMPL;
}
return hres;
}
static HRESULT WINAPI Uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY uriProp, DWORD *pcchProperty, DWORD dwFlags)
......@@ -278,12 +319,10 @@ static HRESULT WINAPI Uri_GetQuery(IUri *iface, BSTR *pstrQuery)
static HRESULT WINAPI Uri_GetRawUri(IUri *iface, BSTR *pstrRawUri)
{
Uri *This = URI_THIS(iface);
FIXME("(%p)->(%p)\n", This, pstrRawUri);
if(!pstrRawUri)
return E_POINTER;
TRACE("(%p)->(%p)\n", This, pstrRawUri);
return E_NOTIMPL;
/* Just forward the call to GetPropertyBSTR. */
return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_RAW_URI, pstrRawUri, 0);
}
static HRESULT WINAPI Uri_GetSchemeName(IUri *iface, BSTR *pstrSchemeName)
......@@ -454,6 +493,14 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
ret->lpIUriVtbl = &UriVtbl;
ret->ref = 1;
/* Create a copy of pwzURI and store it as the raw_uri. */
ret->raw_uri = SysAllocString(pwzURI);
if(!ret->raw_uri) {
heap_free(ret);
return E_OUTOFMEMORY;
}
*ppURI = URI(ret);
return S_OK;
}
......
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