ossl_recv: SSL_read() returning 0 is an error too
authorMike Giancola <mikegiancola@gmail.com>
Wed, 22 May 2013 21:42:33 +0000 (23:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 22 May 2013 21:42:33 +0000 (23:42 +0200)
SSL_read can return 0 for "not successful", according to the open SSL
documentation: http://www.openssl.org/docs/ssl/SSL_read.html

lib/ssluse.c

index 80fa119574f7940861e3ba855574ae59cd5cf833..36c38042ac964669a6e3b8b21e1dc223dd65ab4b 100644 (file)
@@ -2595,7 +2595,7 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
 
   buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
   nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize);
-  if(nread < 0) {
+  if(nread <= 0) {
     /* failed SSL_read */
     int err = SSL_get_error(conn->ssl[num].handle, (int)nread);