[PATCH 2/2] wininet/tests: Fix test failures on Windows XP.

Zebediah Figura z.figura12 at gmail.com
Tue Jan 14 20:01:49 CST 2020


On 1/9/20 7:34 AM, Hans Leidekker wrote:
> Signed-off-by: Hans Leidekker <hans at codeweavers.com>
> ---
>  dlls/wininet/tests/http.c | 23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 

So, out of curiosity, didn't this used to work? Do we know why it
started failing?

> diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
> index 8f3d02e664..e0ea78cfb4 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();
> 



More information about the wine-devel mailing list