mbedtls: treat zero return from mbedtls_ssl_read() as non-error

Patch-by: jshanab on github
Fixes #2899

Daniel Stenberg 3 months ago
parent
commit
acb2fd6756
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/vtls/mbedtls.c

+ 2 - 1
lib/vtls/mbedtls.c

@@ -795,7 +795,8 @@ static ssize_t mbed_recv(struct connectdata *conn, int num,
795 795
   if(ret <= 0) {
796 796
     if(ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY)
797 797
       return 0;
798
-
798
+    else if(!ret)
799
+      return 0;
799 800
     *curlcode = (ret == MBEDTLS_ERR_SSL_WANT_READ) ?
800 801
       CURLE_AGAIN : CURLE_RECV_ERROR;
801 802
     return -1;