[ros-diffs] [cgutman] 52106: [WINHTTP_WINETEST] - Sync to wine 1.3.21

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Jun 5 21:41:14 UTC 2011


Author: cgutman
Date: Sun Jun  5 21:41:14 2011
New Revision: 52106

URL: http://svn.reactos.org/svn/reactos?rev=52106&view=rev
Log:
[WINHTTP_WINETEST]
- Sync to wine 1.3.21

Modified:
    trunk/rostests/winetests/winhttp/notification.c
    trunk/rostests/winetests/winhttp/winhttp.c

Modified: trunk/rostests/winetests/winhttp/notification.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/notification.c?rev=52106&r1=52105&r2=52106&view=diff
==============================================================================
--- trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] Sun Jun  5 21:41:14 2011
@@ -46,6 +46,7 @@
     unsigned int status;    /* status received */
     int todo;
     int ignore;
+    int skipped_for_proxy;
 };
 
 struct info
@@ -58,6 +59,25 @@
     unsigned int line;
 };
 
+static BOOL proxy_active(void)
+{
+    WINHTTP_PROXY_INFO proxy_info;
+    BOOL active = FALSE;
+
+    if (WinHttpGetDefaultProxyConfiguration(&proxy_info))
+    {
+        active = (proxy_info.lpszProxy != NULL);
+        if (active)
+            GlobalFree((HGLOBAL) proxy_info.lpszProxy);
+        if (proxy_info.lpszProxyBypass != NULL)
+            GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass);
+    }
+    else
+       active = FALSE;
+
+    return active;
+}
+
 static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID buffer, DWORD buflen )
 {
     BOOL status_ok, function_ok;
@@ -88,6 +108,12 @@
         }
     }
     if (status_ok) info->index++;
+    if (proxy_active())
+    {
+        while (info->test[info->index].skipped_for_proxy)
+            info->index++;
+    }
+
     if (status & (WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING))
     {
         SetEvent( info->wait );
@@ -222,10 +248,10 @@
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0, 0, 1 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
@@ -269,6 +295,7 @@
 
     setup_test( &info, winhttp_send_request, __LINE__ );
     ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+    ok(ret, "failed to send request %u\n", GetLastError());
 
     setup_test( &info, winhttp_receive_response, __LINE__ );
     ret = WinHttpReceiveResponse( req, NULL );
@@ -299,10 +326,10 @@
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
-    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0, 0, 1 },
+    { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0, 0, 1 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
     { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },

Modified: trunk/rostests/winetests/winhttp/winhttp.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/winhttp.c?rev=52106&r1=52105&r2=52106&view=diff
==============================================================================
--- trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] Sun Jun  5 21:41:14 2011
@@ -33,6 +33,25 @@
     {'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0};
 static const WCHAR test_server[] = {'w','i','n','e','h','q','.','o','r','g',0};
 static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0};
+
+static BOOL proxy_active(void)
+{
+    WINHTTP_PROXY_INFO proxy_info;
+    BOOL active = FALSE;
+
+    if (WinHttpGetDefaultProxyConfiguration(&proxy_info))
+    {
+        active = (proxy_info.lpszProxy != NULL);
+        if (active)
+            GlobalFree((HGLOBAL) proxy_info.lpszProxy);
+        if (proxy_info.lpszProxyBypass != NULL)
+            GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass);
+    }
+    else
+       active = FALSE;
+
+    return active;
+}
 
 static void test_QueryOption(void)
 {
@@ -770,6 +789,8 @@
     DWORD size, status, policy, bitness;
     BOOL ret;
     CERT_CONTEXT *cert;
+    WINHTTP_CERTIFICATE_INFO info;
+    char buffer[32];
 
     ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
     ok(ses != NULL, "failed to open session %u\n", GetLastError());
@@ -794,7 +815,7 @@
     ok(ret, "failed to send request %u\n", GetLastError());
 
     ret = WinHttpReceiveResponse(req, NULL);
-    ok(!ret, "succeeded unexpectedly\n");
+    ok(!ret || proxy_active(), "succeeded unexpectedly\n");
 
     size = 0;
     ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_RAW_HEADERS_CRLF, NULL, NULL, &size, NULL);
@@ -823,6 +844,17 @@
     ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_KEY_BITNESS, &bitness, &size );
     ok(ret, "failed to retrieve key bitness %u\n", GetLastError());
 
+    size = sizeof(info);
+    ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT, &info, &size );
+    ok(ret, "failed to retrieve certificate info %u\n", GetLastError());
+
+    trace("lpszSubjectInfo %s\n", wine_dbgstr_w(info.lpszSubjectInfo));
+    trace("lpszIssuerInfo %s\n", wine_dbgstr_w(info.lpszIssuerInfo));
+    trace("lpszProtocolName %s\n", wine_dbgstr_w(info.lpszProtocolName));
+    trace("lpszSignatureAlgName %s\n", wine_dbgstr_w(info.lpszSignatureAlgName));
+    trace("lpszEncryptionAlgName %s\n", wine_dbgstr_w(info.lpszEncryptionAlgName));
+    trace("dwKeySize %u\n", info.dwKeySize);
+
     ret = WinHttpReceiveResponse(req, NULL);
     ok(ret, "failed to receive response %u\n", GetLastError());
 
@@ -834,6 +866,14 @@
     size = 0;
     ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_RAW_HEADERS_CRLF, NULL, NULL, &size, NULL);
     ok(!ret, "succeeded unexpectedly\n");
+
+    for (;;)
+    {
+        size = 0;
+        ret = WinHttpReadData(req, buffer, sizeof(buffer), &size);
+        ok(ret == TRUE, "WinHttpReadData failed: %u.\n", GetLastError());
+        if (!size) break;
+    }
 
 cleanup:
     WinHttpCloseHandle(req);
@@ -1648,28 +1688,33 @@
     DWORD timeout;
     BOOL ret;
 
-    ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
-    ok(ses != NULL, "failed to open session %u\n", GetLastError());
-
-    timeout = 10000;
-    ret = WinHttpSetOption(ses, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeout, sizeof(timeout));
-    ok(ret, "failed to set resolve timeout %u\n", GetLastError());
-
-    con = WinHttpConnect(ses, nxdomain, 0, 0);
-    ok(con != NULL, "failed to open a connection %u\n", GetLastError());
-
-    req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
-    ok(req != NULL, "failed to open a request %u\n", GetLastError());
-
-    SetLastError(0xdeadbeef);
-    ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
-    ok(!ret, "sent request\n");
-    ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED,
-       "expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n", GetLastError());
-
-    WinHttpCloseHandle(req);
-    WinHttpCloseHandle(con);
-    WinHttpCloseHandle(ses);
+    if (! proxy_active())
+    {
+        ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
+        ok(ses != NULL, "failed to open session %u\n", GetLastError());
+
+        timeout = 10000;
+        ret = WinHttpSetOption(ses, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeout, sizeof(timeout));
+        ok(ret, "failed to set resolve timeout %u\n", GetLastError());
+
+        con = WinHttpConnect(ses, nxdomain, 0, 0);
+        ok(con != NULL, "failed to open a connection %u\n", GetLastError());
+
+        req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
+        ok(req != NULL, "failed to open a request %u\n", GetLastError());
+
+        SetLastError(0xdeadbeef);
+        ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
+        ok(!ret, "sent request\n");
+        ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED,
+           "expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n", GetLastError());
+
+        WinHttpCloseHandle(req);
+        WinHttpCloseHandle(con);
+        WinHttpCloseHandle(ses);
+    }
+    else
+       skip("Skipping host resolution tests, host resolution preformed by proxy\n");
 
     ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
     ok(ses != NULL, "failed to open session %u\n", GetLastError());




More information about the Ros-diffs mailing list