wininet: Don't clear the auth data for Basic authentication in HTTP_InsertAuthorizationForHeader.

It isn't tracked per connection, unlike NTLM authentication, and so the 
server will return a 401 error and try to get us to authenticate again. 
However, this doesn't work as the authentication information is assumed 
by the code to be valid for the whole connection.
This commit is contained in:
Rob Shearman 2007-11-27 14:19:50 +00:00 committed by Alexandre Julliard
parent 4171309731
commit 01826e0c98
1 changed files with 9 additions and 4 deletions

View File

@ -1193,6 +1193,7 @@ static BOOL HTTP_InsertAuthorizationForHeader( LPWININETHTTPREQW lpwhr, struct H
if (pAuthInfo && pAuthInfo->auth_data_len) if (pAuthInfo && pAuthInfo->auth_data_len)
{ {
static const WCHAR wszSpace[] = {' ',0}; static const WCHAR wszSpace[] = {' ',0};
static const WCHAR wszBasic[] = {'B','a','s','i','c',0};
unsigned int len; unsigned int len;
/* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */ /* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */
@ -1208,10 +1209,14 @@ static BOOL HTTP_InsertAuthorizationForHeader( LPWININETHTTPREQW lpwhr, struct H
authorization+strlenW(authorization)); authorization+strlenW(authorization));
/* clear the data as it isn't valid now that it has been sent to the /* clear the data as it isn't valid now that it has been sent to the
* server */ * server, unless it's Basic authentication which doesn't do
HeapFree(GetProcessHeap(), 0, pAuthInfo->auth_data); * connection tracking */
pAuthInfo->auth_data = NULL; if (strcmpiW(pAuthInfo->scheme, wszBasic))
pAuthInfo->auth_data_len = 0; {
HeapFree(GetProcessHeap(), 0, pAuthInfo->auth_data);
pAuthInfo->auth_data = NULL;
pAuthInfo->auth_data_len = 0;
}
} }
TRACE("Inserting authorization: %s\n", debugstr_w(authorization)); TRACE("Inserting authorization: %s\n", debugstr_w(authorization));