Hans Leidekker : wininet: Parse the redirect URL in HTTP_HandleRedirect in case of a proxy connection .

Alexandre Julliard julliard at winehq.org
Tue Apr 1 06:51:27 CDT 2008


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

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Mon Mar 31 20:25:57 2008 +0200

wininet: Parse the redirect URL in HTTP_HandleRedirect in case of a proxy connection.

---

 dlls/wininet/http.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 6198651..912a07f 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2864,6 +2864,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
 {
     LPWININETHTTPSESSIONW lpwhs = lpwhr->lpHttpSession;
     LPWININETAPPINFOW hIC = lpwhs->lpAppInfo;
+    BOOL using_proxy = hIC->lpszProxy && hIC->lpszProxy[0];
     WCHAR path[2048];
 
     if(lpszUrl[0]=='/')
@@ -2871,11 +2872,6 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
         /* if it's an absolute path, keep the same session info */
         lstrcpynW(path, lpszUrl, 2048);
     }
-    else if (NULL != hIC->lpszProxy && hIC->lpszProxy[0] != 0)
-    {
-        TRACE("Redirect through proxy\n");
-        lstrcpynW(path, lpszUrl, 2048);
-    }
     else
     {
         URL_COMPONENTSW urlComponents;
@@ -2997,11 +2993,9 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
                            HTTP_ADDHDR_FLAG_ADD_IF_NEW);
 #endif
         
-        HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName);
-        lpwhs->lpszServerName = WININET_strdupW(hostName);
         HeapFree(GetProcessHeap(), 0, lpwhs->lpszHostName);
         if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT &&
-                urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT)
+            urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT)
         {
             int len;
             static const WCHAR fmt[] = {'%','s',':','%','i',0};
@@ -3015,20 +3009,27 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
 
         HTTP_ProcessHeader(lpwhr, szHost, lpwhs->lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ);
 
-        
         HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName);
         lpwhs->lpszUserName = NULL;
         if (userName[0])
             lpwhs->lpszUserName = WININET_strdupW(userName);
-        lpwhs->nServerPort = urlComponents.nPort;
 
-        if (!HTTP_ResolveName(lpwhr))
-            return FALSE;
+        if (!using_proxy)
+        {
+            HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName);
+            lpwhs->lpszServerName = WININET_strdupW(hostName);
+            lpwhs->nServerPort = urlComponents.nPort;
 
-        NETCON_close(&lpwhr->netConnection);
+            if (!HTTP_ResolveName(lpwhr))
+                return FALSE;
 
-        if (!NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
-            return FALSE;
+            NETCON_close(&lpwhr->netConnection);
+
+            if (!NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
+                return FALSE;
+        }
+        else
+            TRACE("Redirect through proxy\n");
     }
 
     HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath);




More information about the wine-cvs mailing list