From 4c640f24c9901ccaf8706de31e22149130c57be6 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Thu, 9 Jan 2020 14:34:57 +0100 Subject: [PATCH] wininet/tests: Fix test failures on Windows XP. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wininet/tests/http.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 8f3d02e664a..e0ea78cfb4a 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -42,6 +42,7 @@ #define TEST_URL "http://test.winehq.org/tests/hello.html" static BOOL first_connection_to_test_url = TRUE; +static BOOL https_support = TRUE; /* Adapted from dlls/urlmon/tests/protocol.c */ @@ -6220,6 +6221,12 @@ static void test_security_flags(void) char buf[100]; BOOL res; + if (!https_support) + { + win_skip("Can't make https connections, skipping security flags test\n"); + return; + } + trace("Testing security flags...\n"); reset_events(); @@ -6556,7 +6563,7 @@ static void test_secure_connection(void) static const WCHAR get[] = {'G','E','T',0}; static const WCHAR testpage[] = {'/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0}; HINTERNET ses, con, req; - DWORD size, flags; + DWORD size, flags, err; INTERNET_CERTIFICATE_INFOA *certificate_structA = NULL; INTERNET_CERTIFICATE_INFOW *certificate_structW = NULL; BOOL ret; @@ -6574,11 +6581,13 @@ static void test_secure_connection(void) ok(req != NULL, "HttpOpenRequest failed\n"); ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret || broken(GetLastError() == ERROR_INTERNET_CANNOT_CONNECT), - "HttpSendRequest failed: %d\n", GetLastError()); + err = GetLastError(); + ok(ret || broken(err == ERROR_INTERNET_CANNOT_CONNECT) || + broken(err == ERROR_INTERNET_SECURITY_CHANNEL_ERROR), "HttpSendRequest failed: %u\n", err); if (!ret) { win_skip("Cannot connect to https.\n"); + if (err == ERROR_INTERNET_SECURITY_CHANNEL_ERROR) https_support = FALSE; goto done; } @@ -7375,6 +7384,11 @@ static void test_default_service_port(void) ok(request != NULL, "HttpOpenRequest failed\n"); ret = HttpSendRequestA(request, NULL, 0, NULL, 0); + if (!ret && GetLastError() == ERROR_INTERNET_SECURITY_CHANNEL_ERROR) + { + win_skip("Can't make https connection\n"); + goto done; + } ok(ret, "HttpSendRequest failed with error %u\n", GetLastError()); size = sizeof(buffer); @@ -7402,6 +7416,7 @@ static void test_default_service_port(void) ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError()); ok(!strcmp(buffer, "test.winehq.org:443"), "Expected test.winehg.org:443, got '%s'\n", buffer); +done: InternetCloseHandle(request); InternetCloseHandle(connect); InternetCloseHandle(session); @@ -7529,6 +7544,7 @@ START_TEST(http) InternetReadFile_test(INTERNET_FLAG_ASYNC, &test_data[1]); InternetReadFile_test(0, &test_data[1]); InternetReadFile_test(INTERNET_FLAG_ASYNC, &test_data[2]); + test_secure_connection(); test_security_flags(); InternetReadFile_test(0, &test_data[2]); InternetReadFileExA_test(INTERNET_FLAG_ASYNC); @@ -7543,7 +7559,6 @@ START_TEST(http) InternetOpenUrlA_test(); HttpHeaders_test(); test_http_connection(); - test_secure_connection(); test_user_agent_header(); test_bogus_accept_types_array(); InternetReadFile_chunked_test();