Commit ea931c82 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Support IPv6 address format in WsDecodeUrl.

parent 171de0a7
......@@ -50,6 +50,8 @@ static void test_WsDecodeUrl(void)
static const WCHAR url25[] = L"http://host?query%202";
static const WCHAR url26[] = L"http://host#frag%202";
static const WCHAR url27[] = L"http://host/%c3%ab/";
static const WCHAR url28[] = L"net.tcp://[::1]";
static const WCHAR url29[] = L"net.tcp://[::1]:1111";
static const struct
{
const WCHAR *str;
......@@ -97,6 +99,8 @@ static void test_WsDecodeUrl(void)
{ url25, S_OK, WS_URL_HTTP_SCHEME_TYPE, url25 + 7, 4, 80, NULL, 0, NULL, 0, L"query 2", 7 },
{ url26, S_OK, WS_URL_HTTP_SCHEME_TYPE, url26 + 7, 4, 80, NULL, 0, NULL, 0, NULL, 0, L"frag 2", 6 },
{ url27, S_OK, WS_URL_HTTP_SCHEME_TYPE, url27 + 7, 4, 80, NULL, 0, L"/\x00eb/", 3 },
{ url28, S_OK, WS_URL_NETTCP_SCHEME_TYPE, url28 + 10, 5, 808, NULL, 0, NULL, 0 },
{ url29, S_OK, WS_URL_NETTCP_SCHEME_TYPE, url29 + 10, 5, 1111, url29 + 16, 4, NULL, 0 },
};
WS_HEAP *heap;
WS_STRING str;
......
......@@ -169,16 +169,14 @@ static WCHAR *url_decode( WCHAR *str, ULONG len, WS_HEAP *heap, ULONG *ret_len )
/**************************************************************************
* WsDecodeUrl [webservices.@]
*/
HRESULT WINAPI WsDecodeUrl( const WS_STRING *str, ULONG flags, WS_HEAP *heap, WS_URL **ret,
WS_ERROR *error )
HRESULT WINAPI WsDecodeUrl( const WS_STRING *str, ULONG flags, WS_HEAP *heap, WS_URL **ret, WS_ERROR *error )
{
HRESULT hr = WS_E_QUOTA_EXCEEDED;
WCHAR *p, *q, *decoded = NULL;
WS_HTTP_URL *url = NULL;
ULONG len, len_decoded, port = 0;
TRACE( "%s %08x %p %p %p\n", str ? debugstr_wn(str->chars, str->length) : "null", flags,
heap, ret, error );
TRACE( "%s %08x %p %p %p\n", str ? debugstr_wn(str->chars, str->length) : "null", flags, heap, ret, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!str || !heap) return E_INVALIDARG;
......@@ -203,7 +201,15 @@ HRESULT WINAPI WsDecodeUrl( const WS_STRING *str, ULONG flags, WS_HEAP *heap, WS
if (!--len || *++q != '/') goto done;
p = ++q; len--;
while (len && *q != '/' && *q != ':' && *q != '?' && *q != '#') { q++; len--; };
if (*q == '[')
{
while (len && *q != ']') { q++; len--; };
if (*q++ != ']') goto done;
}
else
{
while (len && *q != '/' && *q != ':' && *q != '?' && *q != '#') { q++; len--; };
}
if (q == p) goto done;
url->host.length = q - p;
url->host.chars = p;
......
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