Piotr Caban : wininet: Fix callbacks sent on connection error.

Alexandre Julliard julliard at winehq.org
Wed May 19 10:34:17 CDT 2010


Module: wine
Branch: master
Commit: 4ba60d265a3543d6c4a0be8d4bcd0d306dbd96a0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4ba60d265a3543d6c4a0be8d4bcd0d306dbd96a0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed May 19 01:48:58 2010 +0200

wininet: Fix callbacks sent on connection error.

---

 dlls/wininet/http.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index f72cf3b..9f96f8a 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3668,7 +3668,7 @@ lend:
             HTTP_ReceiveRequestData(lpwhr, TRUE);
         else
         {
-            iar.dwResult = (DWORD_PTR)lpwhr->hdr.hInternet;
+            iar.dwResult = 0;
             iar.dwError = res;
 
             INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
@@ -4360,6 +4360,10 @@ static DWORD HTTP_OpenConnection(http_request_t *lpwhr)
     if(res != ERROR_SUCCESS)
        goto lend;
 
+    INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
+            INTERNET_STATUS_CONNECTED_TO_SERVER,
+            szaddr, strlen(szaddr)+1);
+
     if (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)
     {
         /* Note: we differ from Microsoft's WinINet here. they seem to have
@@ -4368,20 +4372,20 @@ static DWORD HTTP_OpenConnection(http_request_t *lpwhr)
          * behaviour to be more correct and to not cause any incompatibilities
          * because using a secure connection through a proxy server is a rare
          * case that would be hard for anyone to depend on */
-        if (hIC->lpszProxy && (res = HTTP_SecureProxyConnect(lpwhr)) != ERROR_SUCCESS)
+        if (hIC->lpszProxy && (res = HTTP_SecureProxyConnect(lpwhr)) != ERROR_SUCCESS) {
+            HTTPREQ_CloseConnection(&lpwhr->hdr);
             goto lend;
+        }
 
         res = NETCON_secure_connect(&lpwhr->netConnection, lpwhs->lpszHostName);
         if(res != ERROR_SUCCESS)
         {
             WARN("Couldn't connect securely to host\n");
+            HTTPREQ_CloseConnection(&lpwhr->hdr);
             goto lend;
         }
     }
 
-    INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
-                          INTERNET_STATUS_CONNECTED_TO_SERVER,
-                          szaddr, strlen(szaddr)+1);
 
 lend:
     lpwhr->read_pos = lpwhr->read_size = 0;




More information about the wine-cvs mailing list