Commit 18e17e8d authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Include URL extra info in the path unless the caller asks for it separately.

parent 225fdc35
...@@ -81,6 +81,10 @@ static const WCHAR url19[] = ...@@ -81,6 +81,10 @@ static const WCHAR url19[] =
{'h','t','t','p',':','/','/','?','t','e','x','t','=',0xfb00,0}; {'h','t','t','p',':','/','/','?','t','e','x','t','=',0xfb00,0};
static const WCHAR url20[] = static const WCHAR url20[] =
{'h','t','t','p',':','/','/','/','t','e','x','t','=',0xfb00,0}; {'h','t','t','p',':','/','/','/','t','e','x','t','=',0xfb00,0};
static const WCHAR url21[] =
{'h','t','t','p','s',':','/','/','n','b','a','2','k','1','9','-','w','s','.','2','k','s','p','o','r','t','s','.','c','o','m',':','1','9','1','3','3',
'/','n','b','a','/','v','4','/','A','c','c','o','u','n','t','s','/','g','e','t','_','a','c','c','o','u','n','t','?','x','=','3','7','8','9','5','2',
'6','7','7','5','2','6','5','6','6','3','8','7','6',0};
static const WCHAR url_k1[] = static const WCHAR url_k1[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
...@@ -428,7 +432,7 @@ static void WinHttpCrackUrl_test( void ) ...@@ -428,7 +432,7 @@ static void WinHttpCrackUrl_test( void )
static const WCHAR pathW[] = static const WCHAR pathW[] =
{'/','p','a','t','h','%','2','0','w','i','t','h','%','2','0','s','p','a','c','e','s',0}; {'/','p','a','t','h','%','2','0','w','i','t','h','%','2','0','s','p','a','c','e','s',0};
URL_COMPONENTSW uc; URL_COMPONENTSW uc;
WCHAR scheme[20], user[20], pass[20], host[20], path[80], extra[40]; WCHAR scheme[20], user[20], pass[20], host[40], path[80], extra[40];
DWORD error; DWORD error;
BOOL ret; BOOL ret;
...@@ -843,6 +847,19 @@ static void WinHttpCrackUrl_test( void ) ...@@ -843,6 +847,19 @@ static void WinHttpCrackUrl_test( void )
ret = WinHttpCrackUrl( url17, 0, 0, &uc ); ret = WinHttpCrackUrl( url17, 0, 0, &uc );
ok( ret, "got %u\n", GetLastError() ); ok( ret, "got %u\n", GetLastError() );
todo_wine ok( uc.nPort == 80, "got %u\n", uc.nPort ); todo_wine ok( uc.nPort == 80, "got %u\n", uc.nPort );
memset( &uc, 0, sizeof(uc) );
uc.dwStructSize = sizeof(uc);
uc.lpszScheme = scheme;
uc.dwSchemeLength = ARRAY_SIZE(scheme);
uc.lpszHostName = host;
uc.dwHostNameLength = ARRAY_SIZE(host);
uc.lpszUrlPath = path;
uc.dwUrlPathLength = ARRAY_SIZE(path);
ret = WinHttpCrackUrl( url21, 0, 0, &uc );
ok( ret, "got %u\n", GetLastError() );
ok( !lstrcmpW( uc.lpszUrlPath, url21 + 37 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
ok( uc.dwUrlPathLength == 50, "unexpected length %u\n", uc.dwUrlPathLength );
} }
START_TEST(url) START_TEST(url)
......
...@@ -179,7 +179,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -179,7 +179,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
TRACE("%s, %d, %x, %p\n", debugstr_wn(url, len), len, flags, uc); TRACE("%s, %d, %x, %p\n", debugstr_wn(url, len), len, flags, uc);
if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS)) if (!url || !uc || uc->dwStructSize != sizeof(*uc))
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
...@@ -268,9 +268,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN ...@@ -268,9 +268,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
if ((r = memchrW( q, '?', len - (q - url) ))) if ((r = memchrW( q, '?', len - (q - url) )))
{ {
if (uc->dwExtraInfoLength)
{
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, r - q, flags, &overflow ))) goto exit; if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, r - q, flags, &overflow ))) goto exit;
if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, r, len - (r - url), flags, &overflow ))) goto exit; if ((err = set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, r, len - (r - url), flags, &overflow ))) goto exit;
} }
else if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, len - (q - url), flags, &overflow ))) goto exit;
}
else else
{ {
if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, len - (q - url), flags, &overflow ))) goto exit; if ((err = set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, len - (q - url), flags, &overflow ))) goto exit;
......
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