winhttp: Don't drain content until authorization is handled successfully.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2015-12-23 11:06:01 +01:00 committed by Alexandre Julliard
parent e10c48143a
commit d3f7519035
2 changed files with 2 additions and 5 deletions

View file

@ -2421,8 +2421,8 @@ static BOOL receive_response( request_t *request, BOOL async )
{
if (request->hdr.disable_flags & WINHTTP_DISABLE_AUTHENTICATION) break;
drain_content( request );
if (!handle_authorization( request, status )) break;
drain_content( request );
/* recurse synchronously */
if ((ret = send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ))) continue;
@ -3062,7 +3062,7 @@ static HRESULT WINAPI winhttp_request_SetCredentials(
DWORD target, scheme = WINHTTP_AUTH_SCHEME_BASIC; /* FIXME: query supported schemes */
DWORD err = ERROR_SUCCESS;
TRACE("%p, %s, %p\n", request, debugstr_w(username), password);
TRACE("%p, %s, %p, 0x%08x\n", request, debugstr_w(username), password, flags);
EnterCriticalSection( &request->cs );
if (request->state < REQUEST_STATE_OPEN)

View file

@ -2317,9 +2317,7 @@ static void test_basic_authentication(int port)
ok(ret || broken(error == ERROR_WINHTTP_SHUTDOWN || error == ERROR_WINHTTP_TIMEOUT) /* XP */, "failed to read data %u\n", GetLastError());
if (ret)
{
todo_wine
ok(size == 12, "expected 12, got %u\n", size);
todo_wine
ok(!memcmp(buffer, unauthorized, 12), "got %s\n", buffer);
}
@ -3651,7 +3649,6 @@ static void test_IWinHttpRequest(int port)
hr = IWinHttpRequest_get_ResponseText( req, &response );
ok( hr == S_OK, "got %08x\n", hr );
todo_wine
ok( !memcmp( response, unauthW, sizeof(unauthW) ), "got %s\n", wine_dbgstr_w(response) );
SysFreeString( response );