[Wine-patches] [eter-2.1 4/9] winhttp: Make sure to clear response headers from a previous request. (eterbug #10937).

Dmitry Timoshkov dmitry на baikal.ru
Пн Дек 14 10:33:32 MSK 2015


From: Hans Leidekker <hans на codeweavers.com>
---
 dlls/winhttp/request.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 0595407..f53c70f 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1039,6 +1039,20 @@ static BOOL add_host_header( request_t *request, DWORD modifier )
     return ret;
 }
 
+static void clear_response_headers( request_t *request )
+{
+    unsigned int i;
+
+    for (i = 0; i < request->num_headers; i++)
+    {
+        if (!request->headers[i].field) continue;
+        if (!request->headers[i].value) continue;
+        if (request->headers[i].is_request) continue;
+        delete_header( request, i );
+        i--;
+    }
+}
+
 static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len, LPVOID optional,
                           DWORD optional_len, DWORD total_len, DWORD_PTR context, BOOL async )
 {
@@ -1054,6 +1068,8 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
     int bytes_sent;
     DWORD len, i, flags;
 
+    clear_response_headers( request );
+
     flags = WINHTTP_ADDREQ_FLAG_ADD|WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA;
     for (i = 0; i < request->num_accept_types; i++)
     {
@@ -1458,20 +1474,6 @@ static BOOL handle_authorization( request_t *request, DWORD status )
     return FALSE;
 }
 
-static void clear_response_headers( request_t *request )
-{
-    unsigned int i;
-
-    for (i = 0; i < request->num_headers; i++)
-    {
-        if (!request->headers[i].field) continue;
-        if (!request->headers[i].value) continue;
-        if (request->headers[i].is_request) continue;
-        delete_header( request, i );
-        i--;
-    }
-}
-
 #define MAX_REPLY_LEN   1460
 #define INITIAL_HEADER_BUFFER_LEN  512
 
@@ -1898,7 +1900,6 @@ static BOOL receive_response( request_t *request, BOOL async )
 
             if (!(ret = handle_redirect( request, status ))) break;
 
-            clear_response_headers( request );
             send_request( request, NULL, 0, NULL, 0, 0, 0, FALSE ); /* recurse synchronously */
             continue;
         }
@@ -1912,7 +1913,6 @@ static BOOL receive_response( request_t *request, BOOL async )
                 ret = TRUE;
                 break;
             }
-            clear_response_headers( request );
             send_request( request, NULL, 0, NULL, 0, 0, 0, FALSE );
             continue;
         }
-- 
2.6.4



Подробная информация о списке рассылки Wine-patches