Jacek Caban : wininet: Allow passing INTERNET_INVALID_PORT_NUMBER port to get_server.

Alexandre Julliard julliard at winehq.org
Mon Nov 19 13:38:38 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Nov 19 11:47:06 2012 +0100

wininet: Allow passing INTERNET_INVALID_PORT_NUMBER port to get_server.

---

 dlls/wininet/http.c     |   13 ++++---------
 dlls/wininet/internet.c |    3 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 27f8e85..733a535 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -255,6 +255,9 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL
 {
     server_t *iter, *server = NULL;
 
+    if(port == INTERNET_INVALID_PORT_NUMBER)
+        port = is_https ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
+
     EnterCriticalSection(&connection_pool_cs);
 
     LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) {
@@ -1723,9 +1726,6 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
     if( !request->path )
         request->path = szNul;
 
-    if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
-        UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
-
     new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, UrlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
     if(!new_server)
         return FALSE;
@@ -3164,7 +3164,6 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
 {
     appinfo_t *hIC = session->appInfo;
     http_request_t *request;
-    INTERNET_PORT port;
     DWORD len, res = ERROR_SUCCESS;
 
     TRACE("-->\n");
@@ -3191,11 +3190,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
     request->session = session;
     list_add_head( &session->hdr.children, &request->hdr.entry );
 
-    port = session->hostPort;
-    if(port == INTERNET_INVALID_PORT_NUMBER)
-        port = dwFlags & INTERNET_FLAG_SECURE ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
-
-    request->server = get_server(session->hostName, port, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
+    request->server = get_server(session->hostName, session->hostPort, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
     if(!request->server) {
         WININET_Release(&request->hdr);
         return ERROR_OUTOFMEMORY;
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index d982207..d04e825 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -4428,9 +4428,6 @@ BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT
         return FALSE;
     }
 
-    if(url.nPort == INTERNET_INVALID_PORT_NUMBER)
-        url.nPort = INTERNET_DEFAULT_HTTPS_PORT;
-
     server = get_server(hostname, url.nPort, TRUE, FALSE);
     if(!server) {
         SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);




More information about the wine-cvs mailing list