ChangeSet ID: 21477 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/28 05:04:31
Modified files: dlls/wininet : http.c
Log message: Robert Shearman rob@codeweavers.com Simplify HTTP_InsertProxyAuthorization.
Patch: http://cvs.winehq.org/patch.py?id=21477
Old revision New revision Changes Path 1.116 1.117 +9 -19 wine/dlls/wininet/http.c
Index: wine/dlls/wininet/http.c diff -u -p wine/dlls/wininet/http.c:1.116 wine/dlls/wininet/http.c:1.117 --- wine/dlls/wininet/http.c:1.116 28 Nov 2005 11: 4:31 -0000 +++ wine/dlls/wininet/http.c 28 Nov 2005 11: 4:31 -0000 @@ -873,30 +873,20 @@ static LPWSTR HTTP_EncodeBasicAuth( LPCW static BOOL HTTP_InsertProxyAuthorization( LPWININETHTTPREQW lpwhr, LPCWSTR username, LPCWSTR password ) { - HTTPHEADERW hdr; - INT index; - static const WCHAR szProxyAuthorization[] = { - 'P','r','o','x','y','-','A','u','t','h','o','r','i','z','a','t','i','o','n',0 }; + WCHAR *authorization = HTTP_EncodeBasicAuth( username, password ); + BOOL ret;
- hdr.lpszValue = HTTP_EncodeBasicAuth( username, password ); - hdr.lpszField = (WCHAR *)szProxyAuthorization; - hdr.wFlags = HDR_ISREQUEST; - hdr.wCount = 0; - if( !hdr.lpszValue ) + if (!authorization) return FALSE;
- TRACE("Inserting %s = %s\n", - debugstr_w( hdr.lpszField ), debugstr_w( hdr.lpszValue ) ); + TRACE( "Inserting authorization: %s\n", debugstr_w( authorization ) );
- /* remove the old proxy authorization header */ - index = HTTP_GetCustomHeaderIndex( lpwhr, hdr.lpszField ); - if( index >=0 ) - HTTP_DeleteCustomHeader( lpwhr, index ); - - HTTP_InsertCustomHeader(lpwhr, &hdr); - HeapFree( GetProcessHeap(), 0, hdr.lpszValue ); + ret = HTTP_ReplaceHeaderValue( &lpwhr->StdHeaders[HTTP_QUERY_PROXY_AUTHORIZATION], + authorization ); + + HeapFree( GetProcessHeap(), 0, authorization );
- return TRUE; + return ret; }
/***********************************************************************