=?UTF-8?Q?Ri=C4=8Dardas=20Barkauskas=20?=: wininet: Move handling of existing request connections to open_http_connection.

Alexandre Julliard julliard at winehq.org
Tue Nov 26 15:51:43 CST 2013


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

Author: Ričardas Barkauskas <rbarkauskas at codeweavers.com>
Date:   Tue Nov 26 01:12:49 2013 +0200

wininet: Move handling of existing request connections to open_http_connection.

---

 dlls/wininet/http.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index bca1101..09a43f8 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -4786,9 +4786,22 @@ static DWORD open_http_connection(http_request_t *request, BOOL *reusing)
     netconn_t *netconn = NULL;
     DWORD res;
 
-    assert(!request->netconn);
     reset_data_stream(request);
 
+    if (request->netconn)
+    {
+        if (NETCON_is_alive(request->netconn))
+        {
+            *reusing = TRUE;
+            return ERROR_SUCCESS;
+        }
+        else
+        {
+            free_netconn(request->netconn);
+            request->netconn = NULL;
+        }
+    }
+
     res = HTTP_ResolveName(request);
     if(res != ERROR_SUCCESS)
         return res;
@@ -4936,20 +4949,6 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
 
         loop_next = FALSE;
 
-        if (request->netconn)
-        {
-            if (!NETCON_is_alive(request->netconn))
-            {
-                free_netconn(request->netconn);
-                request->netconn = NULL;
-            }
-            else
-            {
-                reset_data_stream(request);
-            }
-        }
-        reusing_connection = request->netconn != NULL;
-
         if(redirected) {
             request->contentLength = ~0u;
             request->bytesToWrite = 0;
@@ -4984,7 +4983,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
  
         TRACE("Request header -> %s\n", debugstr_w(requestString) );
 
-        if (!reusing_connection && (res = open_http_connection(request, &reusing_connection)) != ERROR_SUCCESS)
+        res = open_http_connection(request, &reusing_connection);
+        if (res != ERROR_SUCCESS)
             break;
 
         /* send the request as ASCII, tack on the optional data */




More information about the wine-cvs mailing list