diff options
Diffstat (limited to 'lib/ssluse.c')
-rw-r--r-- | lib/ssluse.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c index 503f7efe5..ab177009a 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -584,6 +584,29 @@ void Curl_ossl_cleanup(void) #endif } +/* + * This function uses SSL_peek to determine connection status. + * + * Return codes: + * 1 means the connection is still in place + * 0 means the connection has been closed + * -1 means the connection status is unknown + */ +int Curl_ossl_check_cxn(struct connectdata *conn) +{ + int rc; + char buf; + + rc = SSL_peek(conn->ssl[FIRSTSOCKET].handle, (void*)&buf, 1); + if (rc > 0) + return 1; /* connection still in place */ + + if (rc == 0) + return 0; /* connection has been closed */ + + return -1; /* connection status unknown */ +} + #endif /* USE_SSLEAY */ /* Selects an OpenSSL crypto engine |