From a9b405cf9a826b90c7bf56ad5b67f60ed0088e2e Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 1 Jun 2004 20:19:56 +0000 Subject: [PATCH] Fix proxy support, remove typecasts. --- dlls/wininet/dialogs.c | 12 ++++++++---- dlls/wininet/http.c | 2 +- dlls/wininet/internet.c | 18 +++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/dlls/wininet/dialogs.c b/dlls/wininet/dialogs.c index 9ca22906617..9187ed8f3df 100644 --- a/dlls/wininet/dialogs.c +++ b/dlls/wininet/dialogs.c @@ -58,11 +58,12 @@ struct WININET_ErrorDlgParams */ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) { - LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest; + LPWININETHTTPREQW lpwhr; LPWININETHTTPSESSIONW lpwhs = NULL; LPWININETAPPINFOW hIC = NULL; LPWSTR p; + lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest ); if (NULL == lpwhr) return FALSE; @@ -195,11 +196,15 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest, LPWSTR username, LPWSTR password ) { - LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest; + LPWININETHTTPREQW lpwhr; LPWININETHTTPSESSIONW lpwhs; LPWININETAPPINFOW hIC; LPWSTR p; + lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest ); + if( !lpwhr ) + return FALSE; + lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent; if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) { @@ -273,7 +278,6 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog( case WM_COMMAND: if( wParam == IDOK ) { - LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) params->hRequest; WCHAR username[0x20], password[0x20]; username[0] = 0; @@ -296,7 +300,7 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog( { WININET_GetSetPassword( hdlg, szServer, szRealm, TRUE ); } - WININET_SetProxyAuthorization( lpwhr, username, password ); + WININET_SetProxyAuthorization( params->hRequest, username, password ); EndDialog( hdlg, ERROR_INTERNET_FORCE_RETRY ); return TRUE; diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 64f87abfaa5..4c3391dae78 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -540,7 +540,7 @@ static BOOL HTTP_DealWithProxy( LPWININETAPPINFOW hIC, static const WCHAR szNul[] = { 0 }; URL_COMPONENTSW UrlComponents; static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }, szSlash[] = { '/',0 } ; - static const WCHAR szFormat1[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 }; + static const WCHAR szFormat1[] = { 'h','t','t','p',':','/','/','%','s',0 }; static const WCHAR szFormat2[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 }; int len; diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index c4feac6ca4d..f81348e5ded 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1172,10 +1172,10 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, * :[//][/path][;][?][#] * */ - LPWSTR lpszParam = NULL; + LPCWSTR lpszParam = NULL; BOOL bIsAbsolute = FALSE; - LPWSTR lpszap = (WCHAR*)lpszUrl; - LPWSTR lpszcp = NULL; + LPCWSTR lpszap = lpszUrl; + LPCWSTR lpszcp = NULL; const WCHAR lpszSeparators[3]={';','?',0}; const WCHAR lpszSlash[2]={'/',0}; if(dwUrlLength==0) @@ -1198,7 +1198,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, } else { - lpszcp = (LPWSTR)lpszUrl; /* Relative url */ + lpszcp = lpszUrl; /* Relative url */ } break; @@ -1217,7 +1217,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, if (bIsAbsolute) /* Parse :[//] */ { - LPWSTR lpszNetLoc; + LPCWSTR lpszNetLoc; static const WCHAR wszAbout[]={'a','b','o','u','t',':',0}; /* Get scheme first. */ @@ -1265,8 +1265,8 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, /* Parse net-loc */ if (lpszNetLoc) { - LPWSTR lpszHost; - LPWSTR lpszPort; + LPCWSTR lpszHost; + LPCWSTR lpszPort; /* [[<:password>]@][:] */ /* First find the user and password if they exist */ @@ -1280,8 +1280,8 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, } else /* Parse out username and password */ { - LPWSTR lpszUser = lpszcp; - LPWSTR lpszPasswd = lpszHost; + LPCWSTR lpszUser = lpszcp; + LPCWSTR lpszPasswd = lpszHost; while (lpszcp < lpszHost) {