From 05a10d5fc80c36f7d2ed5ab3ef733f9539e08984 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20M=C3=BCller?= Date: Tue, 26 Apr 2016 23:38:52 +0200 Subject: [PATCH] wininet/tests: Add more tests for INTERNET_INVALID_PORT_NUMBER. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Müller Signed-off-by: Sebastian Lackner Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- 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 82fd10b5d3d..66ba526f2fc 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); -- 2.11.4.GIT