From: Adam Dickmeiss Date: Thu, 11 Aug 2011 08:31:25 +0000 (+0200) Subject: SSL: Handle EOF case in ssl_get X-Git-Tag: v4.2.8~6 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=ec603701ef51f85beef83898aa36e385028692f1 SSL: Handle EOF case in ssl_get If gnutls was in use and gnutls_record_recv returned 0 (EOF) the ssl_get function would never terminate. --- diff --git a/src/tcpip.c b/src/tcpip.c index b9466d6..c3a4b05 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -1159,7 +1159,12 @@ int ssl_get(COMSTACK h, char **buf, int *bufsize) #if HAVE_GNUTLS_H res = gnutls_record_recv(sp->session, *buf + hasread, CS_TCPIP_BUFCHUNK); - if (res < 0) + if (res == 0) + { + TRC(fprintf(stderr, "gnutls_record_recv returned 0\n")); + return 0; + } + else if (res < 0) { if (ssl_check_error(h, sp, res)) break;