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

This commit is contained in:
Hans Leidekker 2008-03-31 20:25:57 +02:00 committed by Alexandre Julliard
parent 729631d907
commit 8210e1b454
1 changed files with 16 additions and 15 deletions

View File

@ -2864,6 +2864,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
{ {
LPWININETHTTPSESSIONW lpwhs = lpwhr->lpHttpSession; LPWININETHTTPSESSIONW lpwhs = lpwhr->lpHttpSession;
LPWININETAPPINFOW hIC = lpwhs->lpAppInfo; LPWININETAPPINFOW hIC = lpwhs->lpAppInfo;
BOOL using_proxy = hIC->lpszProxy && hIC->lpszProxy[0];
WCHAR path[2048]; WCHAR path[2048];
if(lpszUrl[0]=='/') 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 */ /* if it's an absolute path, keep the same session info */
lstrcpynW(path, lpszUrl, 2048); lstrcpynW(path, lpszUrl, 2048);
} }
else if (NULL != hIC->lpszProxy && hIC->lpszProxy[0] != 0)
{
TRACE("Redirect through proxy\n");
lstrcpynW(path, lpszUrl, 2048);
}
else else
{ {
URL_COMPONENTSW urlComponents; URL_COMPONENTSW urlComponents;
@ -2997,8 +2993,6 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
HTTP_ADDHDR_FLAG_ADD_IF_NEW); HTTP_ADDHDR_FLAG_ADD_IF_NEW);
#endif #endif
HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName);
lpwhs->lpszServerName = WININET_strdupW(hostName);
HeapFree(GetProcessHeap(), 0, lpwhs->lpszHostName); HeapFree(GetProcessHeap(), 0, lpwhs->lpszHostName);
if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT && if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT &&
urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT) urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT)
@ -3015,11 +3009,15 @@ 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); HTTP_ProcessHeader(lpwhr, szHost, lpwhs->lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ);
HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName);
lpwhs->lpszUserName = NULL; lpwhs->lpszUserName = NULL;
if (userName[0]) if (userName[0])
lpwhs->lpszUserName = WININET_strdupW(userName); lpwhs->lpszUserName = WININET_strdupW(userName);
if (!using_proxy)
{
HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName);
lpwhs->lpszServerName = WININET_strdupW(hostName);
lpwhs->nServerPort = urlComponents.nPort; lpwhs->nServerPort = urlComponents.nPort;
if (!HTTP_ResolveName(lpwhr)) if (!HTTP_ResolveName(lpwhr))
@ -3030,6 +3028,9 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl)
if (!NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)) if (!NETCON_init(&lpwhr->netConnection,lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE))
return FALSE; return FALSE;
} }
else
TRACE("Redirect through proxy\n");
}
HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath);
lpwhr->lpszPath=NULL; lpwhr->lpszPath=NULL;