Paul Gofman : winhttp: Don't send notifications when connection is closed on read finish.

Alexandre Julliard julliard at winehq.org
Fri Oct 15 15:40:05 CDT 2021


Module: wine
Branch: master
Commit: d349013ddea1c407189cd22df2a4ff8bf025085b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d349013ddea1c407189cd22df2a4ff8bf025085b

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Fri Oct 15 16:59:48 2021 +0300

winhttp: Don't send notifications when connection is closed on read finish.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winhttp/request.c            | 10 ++++------
 dlls/winhttp/tests/notification.c | 32 ++++++++------------------------
 2 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 2c064bb767b..c908e26956f 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1797,13 +1797,11 @@ static void finished_reading( struct request *request )
         if (!wcsicmp( connection, L"close" )) close = TRUE;
     }
     else if (!wcscmp( request->version, L"HTTP/1.0" )) close = TRUE;
-    if (close)
-    {
-        close_connection( request );
-        return;
-    }
 
-    cache_connection( request->netconn );
+    if (close)
+        netconn_close( request->netconn );
+    else
+        cache_connection( request->netconn );
     request->netconn = NULL;
 }
 
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index bc1283adcf7..72cef89a618 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -1124,32 +1124,15 @@ static const struct notification read_test[] =
     { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }
 };
 
-static const struct notification read_allow_close_test[] =
-{
-    { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, NF_ALLOW },
-    { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, NF_ALLOW },
-    { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, NF_ALLOW },
-    { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, NF_ALLOW },
-    { winhttp_read_data,        WINHTTP_CALLBACK_STATUS_READ_COMPLETE, NF_SIGNAL }
-};
-
-#define read_request_data(a,b,c,d) _read_request_data(a,b,c,d,__LINE__)
-static void _read_request_data(struct test_request *req, struct info *info, const char *expected_data, BOOL closing_connection, unsigned line)
+#define read_request_data(a,b,c) _read_request_data(a,b,c,__LINE__)
+static void _read_request_data(struct test_request *req, struct info *info, const char *expected_data, unsigned line)
 {
     char buffer[1024];
     DWORD len;
     BOOL ret;
 
-    if (closing_connection)
-    {
-        info->test = read_allow_close_test;
-        info->count = ARRAY_SIZE( read_allow_close_test );
-    }
-    else
-    {
-        info->test = read_test;
-        info->count = ARRAY_SIZE( read_test );
-    }
+    info->test = read_test;
+    info->count = ARRAY_SIZE( read_test );
     info->index = 0;
 
     setup_test( info, winhttp_read_data, line );
@@ -1180,7 +1163,7 @@ static void test_persistent_connection(int port)
                        "Content-Length: 1\r\n"
                        "\r\n"
                        "X" );
-    read_request_data( &req, &info, "X", FALSE );
+    read_request_data( &req, &info, "X" );
     close_request( &req, &info, FALSE );
 
     /* chunked connection test */
@@ -1194,7 +1177,7 @@ static void test_persistent_connection(int port)
                        "\r\n"
                        "9\r\n123456789\r\n"
                        "0\r\n\r\n" );
-    read_request_data( &req, &info, "123456789", FALSE );
+    read_request_data( &req, &info, "123456789" );
     close_request( &req, &info, FALSE );
 
     /* HTTP/1.1 connections are persistent by default, no additional header is needed */
@@ -1206,7 +1189,7 @@ static void test_persistent_connection(int port)
                        "Content-Length: 2\r\n"
                        "\r\n"
                        "xx" );
-    read_request_data( &req, &info, "xx", FALSE );
+    read_request_data( &req, &info, "xx" );
     close_request( &req, &info, FALSE );
 
     open_async_request( port, &req, &info, L"/test", TRUE );
@@ -1218,6 +1201,7 @@ static void test_persistent_connection(int port)
                        "Connection: close\r\n"
                        "\r\n"
                        "yy" );
+    read_request_data( &req, &info, "yy" );
     close_request( &req, &info, TRUE );
 
     SetEvent( server_socket_done );




More information about the wine-cvs mailing list