Jacek Caban : wininet: Get rid of INTERNET_INVALID_PORT_NUMBER fixups after InternetCrackUrl calls.

Alexandre Julliard julliard at wine.codeweavers.com
Wed May 18 10:51:11 CDT 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue May 17 19:20:21 2016 +0200

wininet: Get rid of INTERNET_INVALID_PORT_NUMBER fixups after InternetCrackUrl calls.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wininet/http.c     | 17 +++--------------
 dlls/wininet/internet.c |  9 +--------
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 96f481e..21f6ff2 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -1792,7 +1792,6 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
     URL_COMPONENTSW UrlComponents = { sizeof(UrlComponents) };
     server_t *new_server = NULL;
     WCHAR *proxy;
-    BOOL is_https;
 
     proxy = INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp);
     if(!proxy)
@@ -1813,12 +1812,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
         if( !request->path )
             request->path = szNul;
 
-        is_https = (UrlComponents.nScheme == INTERNET_SCHEME_HTTPS);
-        if (is_https && UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
-            UrlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
-
         new_server = get_server(substr(UrlComponents.lpszHostName, UrlComponents.dwHostNameLength),
-                                UrlComponents.nPort, is_https, TRUE);
+                                UrlComponents.nPort, UrlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
     }
     heap_free(proxy);
     if(!new_server)
@@ -4171,10 +4166,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
                 request->hdr.dwFlags &= ~INTERNET_FLAG_SECURE;
             }
 
-            if(urlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
-                urlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
-            else if(urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT)
-                custom_port = TRUE;
+            custom_port = urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT;
         }else if(!strcmpiW(protocol, httpsW)) {
             if(!(request->hdr.dwFlags & INTERNET_FLAG_SECURE)) {
                 TRACE("redirect from non-secure page to secure page\n");
@@ -4182,10 +4174,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
                 request->hdr.dwFlags |= INTERNET_FLAG_SECURE;
             }
 
-            if(urlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
-                urlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
-            else if(urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT)
-                custom_port = TRUE;
+            custom_port = urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT;
         }
 
         heap_free(session->hostName);
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 9751a49..bd380dc 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3477,8 +3477,6 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
 
     switch(urlComponents.nScheme) {
     case INTERNET_SCHEME_FTP:
-	if(urlComponents.nPort == 0)
-	    urlComponents.nPort = INTERNET_DEFAULT_FTP_PORT;
 	client = FTP_Connect(hIC, host, urlComponents.nPort,
 			     user, pass, dwFlags, dwContext, INET_OPENURL);
 	if(client == NULL)
@@ -3494,12 +3492,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl,
     case INTERNET_SCHEME_HTTPS: {
 	static const WCHAR szStars[] = { '*','/','*', 0 };
 	LPCWSTR accept[2] = { szStars, NULL };
-	if(urlComponents.nPort == 0) {
-	    if(urlComponents.nScheme == INTERNET_SCHEME_HTTP)
-		urlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
-	    else
-		urlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
-	}
+
         if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE;
 
         /* FIXME: should use pointers, not handles, as handles are not thread-safe */




More information about the wine-cvs mailing list