Commit 0d501685 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp/tests: Handle more potential connection failures.

parent 5e6490a8
......@@ -186,6 +186,11 @@ static void test_connection_cache( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
goto done;
}
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
......@@ -209,6 +214,11 @@ static void test_connection_cache( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
goto done;
}
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
......@@ -253,6 +263,11 @@ static void test_connection_cache( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
goto done;
}
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
......@@ -276,6 +291,11 @@ static void test_connection_cache( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
goto done;
}
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
......@@ -288,6 +308,7 @@ static void test_connection_cache( void )
ok(status == 200, "request failed unexpectedly %u\n", status);
setup_test( &info, winhttp_close_handle, __LINE__ );
done:
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
......@@ -353,6 +374,11 @@ static void test_redirect( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
goto done;
}
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
......@@ -365,6 +391,7 @@ static void test_redirect( void )
ok(status == 200, "request failed unexpectedly %u\n", status);
setup_test( &info, winhttp_close_handle, __LINE__ );
done:
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
......@@ -435,6 +462,15 @@ static void test_async( void )
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
{
skip("connection failed, skipping\n");
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
CloseHandle( info.wait );
return;
}
ok(ret, "failed to send request %u\n", GetLastError());
WaitForSingleObject( info.wait, INFINITE );
......
......@@ -954,7 +954,7 @@ static void test_request_parameter_defaults(void)
ok(req != NULL, "failed to open a request %u\n", GetLastError());
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
if (!ret && (GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT || GetLastError() == ERROR_WINHTTP_TIMEOUT))
{
skip("connection failed, skipping\n");
goto done;
......@@ -3044,12 +3044,8 @@ static void test_WinHttpGetProxyForUrl(void)
options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A;
memset( &info, 0, sizeof(info) );
SetLastError(0xdeadbeef);
ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
error = GetLastError();
if (!ret) ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED ||
error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n", error );
else
if (ret)
{
trace("Proxy.AccessType=%u\n", info.dwAccessType);
trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy));
......@@ -3063,11 +3059,8 @@ static void test_WinHttpGetProxyForUrl(void)
options.lpszAutoConfigUrl = wpadW;
memset( &info, 0, sizeof(info) );
SetLastError(0xdeadbeef);
ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
error = GetLastError();
if (!ret) ok( error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n", error );
else
if (ret)
{
trace("Proxy.AccessType=%u\n", info.dwAccessType);
trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy));
......
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