Commit 22edb3e9 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Simplify HTTP_InsertProxyAuthorization.

parent b9d77540
...@@ -873,30 +873,20 @@ static LPWSTR HTTP_EncodeBasicAuth( LPCWSTR username, LPCWSTR password) ...@@ -873,30 +873,20 @@ static LPWSTR HTTP_EncodeBasicAuth( LPCWSTR username, LPCWSTR password)
static BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr, static BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr,
LPCWSTR username, LPCWSTR password ) LPCWSTR username, LPCWSTR password )
{ {
HTTPHEADERW hdr; WCHAR *authorization = HTTP_EncodeBasicAuth( username, password );
INT index; BOOL ret;
static const WCHAR szProxyAuthorization[] = {
'P','r','o','x','y','-','A','u','t','h','o','r','i','z','a','t','i','o','n',0 }; if (!authorization)
hdr.lpszValue = HTTP_EncodeBasicAuth( username, password );
hdr.lpszField = (WCHAR *)szProxyAuthorization;
hdr.wFlags = HDR_ISREQUEST;
hdr.wCount = 0;
if( !hdr.lpszValue )
return FALSE; return FALSE;
TRACE("Inserting %s = %s\n", TRACE( "Inserting authorization: %s\n", debugstr_w( authorization ) );
debugstr_w( hdr.lpszField ), debugstr_w( hdr.lpszValue ) );
/* remove the old proxy authorization header */ ret = HTTP_ReplaceHeaderValue( &lpwhr->StdHeaders[HTTP_QUERY_PROXY_AUTHORIZATION],
index = HTTP_GetCustomHeaderIndex( lpwhr, hdr.lpszField ); authorization );
if( index >=0 )
HTTP_DeleteCustomHeader( lpwhr, index ); HeapFree( GetProcessHeap(), 0, authorization );
HTTP_InsertCustomHeader(lpwhr, &hdr);
HeapFree( GetProcessHeap(), 0, hdr.lpszValue );
return TRUE; return ret;
} }
/*********************************************************************** /***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment