Commit 0d22e43f authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

wininet: Handle INTERNET_INVALID_PORT_NUMBER in HttpOpenRequest.

parent a7845c31
......@@ -3359,7 +3359,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
{
appinfo_t *hIC = session->appInfo;
http_request_t *request;
DWORD len;
DWORD port, len;
TRACE("-->\n");
......@@ -3388,7 +3388,12 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request->session = session;
list_add_head( &session->hdr.children, &request->hdr.entry );
request->server = get_server(substrz(session->hostName), session->hostPort, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
port = session->hostPort;
if (port == INTERNET_INVALID_PORT_NUMBER)
port = (session->hdr.dwFlags & INTERNET_FLAG_SECURE) ?
INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
request->server = get_server(substrz(session->hostName), port, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
if(!request->server) {
WININET_Release(&request->hdr);
return ERROR_OUTOFMEMORY;
......
......@@ -6212,13 +6212,13 @@ static void test_default_service_port(void)
ok(request != NULL, "HttpOpenRequest failed\n");
ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
todo_wine ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
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);
ok(!strcmp(buffer, "test.winehq.org"), "Expected test.winehg.org, got '%s'\n", buffer);
InternetCloseHandle(request);
InternetCloseHandle(connect);
......@@ -6237,7 +6237,7 @@ static void test_default_service_port(void)
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);
ok(!strcmp(buffer, "test.winehq.org:443"), "Expected test.winehg.org:443, got '%s'\n", buffer);
InternetCloseHandle(request);
InternetCloseHandle(connect);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment