Paul Gofman : winhttp: Handle TLS close notify in netconn_is_alive().

Alexandre Julliard julliard at winehq.org
Mon Nov 1 16:38:02 CDT 2021


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Mon Nov  1 16:19:01 2021 +0300

winhttp: Handle TLS close notify in netconn_is_alive().

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/net.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 8597179dc3e..3016608404a 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -616,11 +616,31 @@ DWORD netconn_set_timeout( struct netconn *netconn, BOOL send, int value )
 
 BOOL netconn_is_alive( struct netconn *netconn )
 {
+    SIZE_T size;
     int len;
     char b;
     DWORD err;
+    BOOL eof;
 
     set_blocking( netconn, FALSE );
+    if (netconn->secure)
+    {
+        while (!netconn->peek_msg && !(err = read_ssl_chunk( netconn, NULL, 0, &size, &eof )) && !eof)
+            ;
+
+        TRACE("Checking secure connection, err %d.\n", err);
+
+        if (netconn->peek_msg || err == WSAEWOULDBLOCK)
+        {
+            set_blocking( netconn, TRUE );
+            return TRUE;
+        }
+        if (err != SEC_E_OK && err != SEC_E_INCOMPLETE_MESSAGE)
+        {
+            set_blocking( netconn, TRUE );
+            return FALSE;
+        }
+    }
     len = sock_recv( netconn->socket, &b, 1, MSG_PEEK );
     err = WSAGetLastError();
     set_blocking( netconn, TRUE );




More information about the wine-cvs mailing list