wininet/tests: Add more tests for INTERNET_INVALID_PORT_NUMBER.

Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Müller 2016-04-26 23:38:52 +02:00 committed by Alexandre Julliard
parent d488f6b856
commit 05a10d5fc8

View file

@ -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);