CLOSE_NOTIFY alert is not necessarily an error, if it's received it should
simply return nothing read (= 0)

Thanks
Hoi-Ho
From 0e3e19188fe4d45c80b13bea276bec7172aab5e2 Mon Sep 17 00:00:00 2001
From: Hoi-Ho Chan <[email protected]>
Date: Thu, 17 Feb 2011 21:46:59 -0800
Subject: [PATCH] PolarSSL: Return 0 on receiving TLS CLOSE_NOTIFY alert

Signed-off-by: Hoi-Ho Chan <[email protected]>
---
 lib/polarssl.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/polarssl.c b/lib/polarssl.c
index 272e118..51e35db 100644
--- a/lib/polarssl.c
+++ b/lib/polarssl.c
@@ -352,6 +352,9 @@ static ssize_t polarssl_recv(struct connectdata *conn,
   ret = ssl_read(&conn->ssl[num].ssl, (unsigned char *)buf, buffersize);
 
   if(ret <= 0) {
+    if(ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY)
+      return 0;
+
     *curlcode = (ret == POLARSSL_ERR_NET_TRY_AGAIN) ?
       CURLE_AGAIN : CURLE_RECV_ERROR;
     return -1;
-- 
1.7.1

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to