Dmitry Timoshkov : winhttp/tests: For a secure connection check what WinHttpQueryDataAvailable() returns as well as first chunk of actual data.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 4 08:19:27 CST 2015


Module: wine
Branch: master
Commit: 4b1eae9facbd028291cdc1ff77743e5732d2826a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b1eae9facbd028291cdc1ff77743e5732d2826a

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Dec  4 17:14:38 2015 +0800

winhttp/tests: For a secure connection check what WinHttpQueryDataAvailable() returns as well as first chunk of actual data.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winhttp/tests/winhttp.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index d6b4649..1dbfe08 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -970,8 +970,9 @@ static void CALLBACK cert_error(HINTERNET handle, DWORD_PTR ctx, DWORD status, L
 
 static void test_secure_connection(void)
 {
+    static const char data_start[] = "<!DOCTYPE html PUBLIC";
     HINTERNET ses, con, req;
-    DWORD size, status, policy, bitness, read_size, err;
+    DWORD size, status, policy, bitness, read_size, err, available_size;
     BOOL ret;
     CERT_CONTEXT *cert;
     WINHTTP_CERTIFICATE_INFO info;
@@ -1050,6 +1051,11 @@ static void test_secure_connection(void)
     ret = WinHttpReceiveResponse(req, NULL);
     ok(ret, "failed to receive response %u\n", GetLastError());
 
+    available_size = 0;
+    ret = WinHttpQueryDataAvailable(req, &available_size);
+    ok(ret, "failed to query available data %u\n", GetLastError());
+    ok(available_size > 2014, "available_size = %u\n", available_size);
+
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL);
@@ -1068,8 +1074,11 @@ static void test_secure_connection(void)
         ok(ret == TRUE, "WinHttpReadData failed: %u.\n", GetLastError());
         if (!size) break;
         read_size += size;
+
+        if (read_size <= 32)
+            ok(!memcmp(buffer, data_start, sizeof(data_start)-1), "not expected: %.32s\n", buffer);
     }
-    ok(read_size > 2014, "read_size = %u\n", read_size);
+    ok(read_size >= available_size, "read_size = %u, available_size = %u\n", read_size, available_size);
 
 cleanup:
     WinHttpCloseHandle(req);




More information about the wine-cvs mailing list