Fix proxy support, remove typecasts.

This commit is contained in:
Mike McCormack 2004-06-01 20:19:56 +00:00 committed by Alexandre Julliard
parent 0f939fc9b5
commit a9b405cf9a
3 changed files with 18 additions and 14 deletions

View File

@ -58,11 +58,12 @@ struct WININET_ErrorDlgParams
*/ */
static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
{ {
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest; LPWININETHTTPREQW lpwhr;
LPWININETHTTPSESSIONW lpwhs = NULL; LPWININETHTTPSESSIONW lpwhs = NULL;
LPWININETAPPINFOW hIC = NULL; LPWININETAPPINFOW hIC = NULL;
LPWSTR p; LPWSTR p;
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest );
if (NULL == lpwhr) if (NULL == lpwhr)
return FALSE; return FALSE;
@ -195,11 +196,15 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer,
static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest, static BOOL WININET_SetProxyAuthorization( HINTERNET hRequest,
LPWSTR username, LPWSTR password ) LPWSTR username, LPWSTR password )
{ {
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) hRequest; LPWININETHTTPREQW lpwhr;
LPWININETHTTPSESSIONW lpwhs; LPWININETHTTPSESSIONW lpwhs;
LPWININETAPPINFOW hIC; LPWININETAPPINFOW hIC;
LPWSTR p; LPWSTR p;
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hRequest );
if( !lpwhr )
return FALSE;
lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent; lpwhs = (LPWININETHTTPSESSIONW) lpwhr->hdr.lpwhparent;
if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION)
{ {
@ -273,7 +278,6 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
case WM_COMMAND: case WM_COMMAND:
if( wParam == IDOK ) if( wParam == IDOK )
{ {
LPWININETHTTPREQW lpwhr = (LPWININETHTTPREQW) params->hRequest;
WCHAR username[0x20], password[0x20]; WCHAR username[0x20], password[0x20];
username[0] = 0; username[0] = 0;
@ -296,7 +300,7 @@ static INT_PTR WINAPI WININET_ProxyPasswordDialog(
{ {
WININET_GetSetPassword( hdlg, szServer, szRealm, TRUE ); WININET_GetSetPassword( hdlg, szServer, szRealm, TRUE );
} }
WININET_SetProxyAuthorization( lpwhr, username, password ); WININET_SetProxyAuthorization( params->hRequest, username, password );
EndDialog( hdlg, ERROR_INTERNET_FORCE_RETRY ); EndDialog( hdlg, ERROR_INTERNET_FORCE_RETRY );
return TRUE; return TRUE;

View File

@ -540,7 +540,7 @@ static BOOL HTTP_DealWithProxy( LPWININETAPPINFOW hIC,
static const WCHAR szNul[] = { 0 }; static const WCHAR szNul[] = { 0 };
URL_COMPONENTSW UrlComponents; URL_COMPONENTSW UrlComponents;
static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }, szSlash[] = { '/',0 } ; 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 }; static const WCHAR szFormat2[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
int len; int len;

View File

@ -1172,10 +1172,10 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
* <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>] * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
* *
*/ */
LPWSTR lpszParam = NULL; LPCWSTR lpszParam = NULL;
BOOL bIsAbsolute = FALSE; BOOL bIsAbsolute = FALSE;
LPWSTR lpszap = (WCHAR*)lpszUrl; LPCWSTR lpszap = lpszUrl;
LPWSTR lpszcp = NULL; LPCWSTR lpszcp = NULL;
const WCHAR lpszSeparators[3]={';','?',0}; const WCHAR lpszSeparators[3]={';','?',0};
const WCHAR lpszSlash[2]={'/',0}; const WCHAR lpszSlash[2]={'/',0};
if(dwUrlLength==0) if(dwUrlLength==0)
@ -1198,7 +1198,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
} }
else else
{ {
lpszcp = (LPWSTR)lpszUrl; /* Relative url */ lpszcp = lpszUrl; /* Relative url */
} }
break; break;
@ -1217,7 +1217,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */ if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */
{ {
LPWSTR lpszNetLoc; LPCWSTR lpszNetLoc;
static const WCHAR wszAbout[]={'a','b','o','u','t',':',0}; static const WCHAR wszAbout[]={'a','b','o','u','t',':',0};
/* Get scheme first. */ /* Get scheme first. */
@ -1265,8 +1265,8 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
/* Parse net-loc */ /* Parse net-loc */
if (lpszNetLoc) if (lpszNetLoc)
{ {
LPWSTR lpszHost; LPCWSTR lpszHost;
LPWSTR lpszPort; LPCWSTR lpszPort;
/* [<user>[<:password>]@]<host>[:<port>] */ /* [<user>[<:password>]@]<host>[:<port>] */
/* First find the user and password if they exist */ /* 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 */ else /* Parse out username and password */
{ {
LPWSTR lpszUser = lpszcp; LPCWSTR lpszUser = lpszcp;
LPWSTR lpszPasswd = lpszHost; LPCWSTR lpszPasswd = lpszHost;
while (lpszcp < lpszHost) while (lpszcp < lpszHost)
{ {