Commit 6cde7564 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Make tests pass on Win7. Conform to the more recent behavior.

parent f7a4936f
......@@ -103,11 +103,11 @@ static const struct notification cache_test[] =
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 }
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
};
static void setup_test( struct info *info, enum api function, unsigned int line )
......@@ -227,11 +227,11 @@ static const struct notification redirect_test[] =
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 }
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
};
static void test_redirect( void )
......@@ -309,11 +309,11 @@ static const struct notification async_test[] =
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0, 1 },
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0, 1 },
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1 }
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
};
static void test_async( void )
......
......@@ -144,16 +144,18 @@ static void WinHttpCreateUrl_test( void )
SetLastError( 0xdeadbeef );
ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
ok( !ret, "expected failure\n" );
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
ok( len == 57, "expected len 57 got %u\n", len );
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
/* correct size, NULL url */
fill_url_components( &uc );
SetLastError( 0xdeadbeef );
ret = WinHttpCreateUrl( &uc, 0, NULL, &len );
ok( !ret, "expected failure\n" );
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER got %u\n", GetLastError() );
ok( len == 57, "expected len 57 got %u\n", len );
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INSUFFICIENT_BUFFER or ERROR_INVALID_PARAMETER got %u\n", GetLastError() );
/* valid components, allocated url, short length */
SetLastError( 0xdeadbeef );
......@@ -315,7 +317,7 @@ static void reset_url_components( URL_COMPONENTS *uc )
static void WinHttpCrackUrl_test( void )
{
URL_COMPONENTSW uc;
WCHAR scheme[20], user[20], pass[20], host[20], path[40], extra[20];
WCHAR scheme[20], user[20], pass[20], host[20], path[80], extra[40];
DWORD error;
BOOL ret;
......@@ -499,17 +501,17 @@ static void WinHttpCrackUrl_test( void )
uc.dwHostNameLength = 20;
uc.nPort = 0;
uc.lpszUrlPath = path;
uc.dwUrlPathLength = 40;
uc.dwUrlPathLength = 80;
uc.lpszExtraInfo = extra;
uc.dwExtraInfoLength = 20;
uc.dwExtraInfoLength = 40;
path[0] = 0;
ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed\n" );
ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() );
ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected path\n" );
ok( uc.dwUrlPathLength == 32, "unexpected path length\n" );
ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n", uc.dwUrlPathLength );
ok( !memcmp( uc.lpszExtraInfo, escape + 21, 12 * sizeof(WCHAR) ), "unexpected extra info\n" );
ok( uc.dwExtraInfoLength == 12, "unexpected extra info length\n" );
ok( uc.dwExtraInfoLength == 12, "unexpected extra info length %u\n", uc.dwExtraInfoLength );
/* Urls with specified port numbers */
/* decoding with buffers */
......
......@@ -368,7 +368,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required);
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required)
if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required || !url)
{
set_last_error( ERROR_INVALID_PARAMETER );
return FALSE;
......@@ -376,7 +376,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
if (!calc_length( uc, flags, &len )) return FALSE;
if (!url || *required < len)
if (*required < len)
{
*required = len + 1;
set_last_error( ERROR_INSUFFICIENT_BUFFER );
......
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