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

Hans Leidekker hans at codeweavers.com
Wed Dec 23 04:06:01 CST 2015


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/winhttp/request.c       | 4 ++--
 dlls/winhttp/tests/winhttp.c | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 79a319a..b2b72c7 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -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)
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 9442085..d676dd8 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -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 );
 
-- 
2.1.4




More information about the wine-patches mailing list