winhttp: Fix invalid behaviour of WinHttpCrackUrl.

This commit is contained in:
Maciej Borsz 2010-03-16 19:58:25 +01:00 committed by Alexandre Julliard
parent e385748258
commit 2ca477c831
2 changed files with 20 additions and 1 deletions

View File

@ -65,6 +65,8 @@ static const WCHAR url10[] =
static const WCHAR url11[] =
{'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
'@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
static const WCHAR url12[] =
{'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0};
@ -565,6 +567,23 @@ static void WinHttpCrackUrl_test( void )
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url12, 0, 0, &uc);
ok( ret, "WinHttpCrackUrl failed\n" );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url12,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
ok( uc.lpszUserName == NULL, "unexpected username\n" );
ok( uc.lpszPassword == NULL, "unexpected password\n" );
ok( uc.lpszHostName == url12 + 7, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
ok( uc.lpszUrlPath == url12 + 18, "unexpected path\n" );
ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
ok( uc.lpszExtraInfo == url12 + 23, "unexpected extra info\n" );
ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" );
}
START_TEST(url)

View File

@ -133,7 +133,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
p += 2;
if (!p[0]) goto exit;
if ((q = memchrW( p, '@', len - (p - url) )))
if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p )))
{
if ((r = memchrW( p, ':', q - p )))
{