From b07e2a08f9a98f7261d82f3ad5931ac5bcfb05a4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 31 Oct 2001 08:44:11 +0000 Subject: nonblock => Curl_nonblock, remade the check for a live SSL connection (again) --- lib/url.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index bd01136d8..b11d33aac 100644 --- a/lib/url.c +++ b/lib/url.c @@ -955,8 +955,27 @@ static bool SocketIsDead(struct connectdata *conn, int sock) #ifdef USE_SSLEAY /* the socket seems fine, but is the SSL later fine too? */ if(conn->ssl.use) { - if(SSL_get_shutdown(conn->ssl.handle)) - return TRUE; /* this connection is dead! */ + int peek; + int error; + Curl_nonblock(sock, TRUE); + + peek = SSL_peek(conn->ssl.handle, + conn->data->state.buffer, BUFSIZE); + + infof(conn->data, "SSL_peek returned %d\n", peek); + + if(-1 == peek) { + error = SSL_get_error(conn->ssl.handle, peek); + infof(conn->data, "SSL_error returned %d\n", error); + + if(SSL_ERROR_WANT_READ != error) + ret_val = TRUE; + } + else + /* peek did not return -1 */ + ret_val = TRUE; + + Curl_nonblock(sock, FALSE); } #endif } -- cgit v1.2.3