aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-10-31 08:44:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-10-31 08:44:11 +0000
commitb07e2a08f9a98f7261d82f3ad5931ac5bcfb05a4 (patch)
tree8dcd7031f8a09389258633ab7da5d2e7e4702598 /lib/url.c
parent64543e09ecea6dc2b1d269cf4b83b5d86729bb01 (diff)
nonblock => Curl_nonblock, remade the check for a live SSL connection (again)
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c23
1 files changed, 21 insertions, 2 deletions
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
}