=?UTF-8?Q?Michael=20M=C3=BCller=20?=: wininet/tests: Add more tests for INTERNET_INVALID_PORT_NUMBER.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 27 10:45:42 CDT 2016


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

Author: Michael Müller <michael at fds-team.de>
Date:   Tue Apr 26 23:38:52 2016 +0200

wininet/tests: Add more tests for INTERNET_INVALID_PORT_NUMBER.

Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wininet/tests/http.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 82fd10b..66ba526 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -5733,7 +5733,8 @@ static void test_connection_failure(void)
 static void test_default_service_port(void)
 {
     HINTERNET session, connect, request;
-    DWORD error;
+    DWORD size, error;
+    char buffer[128];
     BOOL ret;
 
     session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
@@ -5753,6 +5754,50 @@ static void test_default_service_port(void)
     ok(error == ERROR_INTERNET_SECURITY_CHANNEL_ERROR || error == ERROR_INTERNET_CANNOT_CONNECT,
        "got %u\n", error);
 
+    size = sizeof(buffer);
+    memset(buffer, 0, sizeof(buffer));
+    ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    ok(!strcmp(buffer, "test.winehq.org:80"), "Expected test.winehg.org:80, got '%s'\n", buffer);
+
+    InternetCloseHandle(request);
+    InternetCloseHandle(connect);
+
+    connect = InternetConnectA(session, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER, NULL, NULL,
+                               INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0);
+    ok(connect != NULL, "InternetConnect failed\n");
+
+    request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
+    ok(request != NULL, "HttpOpenRequest failed\n");
+
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
+    todo_wine ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+
+    size = sizeof(buffer);
+    memset(buffer, 0, sizeof(buffer));
+    ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    todo_wine ok(!strcmp(buffer, "test.winehq.org"), "Expected test.winehg.org, got '%s'\n", buffer);
+
+    InternetCloseHandle(request);
+    InternetCloseHandle(connect);
+
+    connect = InternetConnectA(session, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER, NULL, NULL,
+                               INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0);
+    ok(connect != NULL, "InternetConnect failed\n");
+
+    request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, 0, 0);
+    ok(request != NULL, "HttpOpenRequest failed\n");
+
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
+    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+
+    size = sizeof(buffer);
+    memset(buffer, 0, sizeof(buffer));
+    ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    todo_wine ok(!strcmp(buffer, "test.winehq.org:443"), "Expected test.winehg.org:443, got '%s'\n", buffer);
+
     InternetCloseHandle(request);
     InternetCloseHandle(connect);
     InternetCloseHandle(session);




More information about the wine-cvs mailing list