aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sslgen.c13
-rw-r--r--lib/sslgen.h4
-rw-r--r--lib/transfer.c12
3 files changed, 18 insertions, 11 deletions
diff --git a/lib/sslgen.c b/lib/sslgen.c
index 33f038017..210ea9af5 100644
--- a/lib/sslgen.c
+++ b/lib/sslgen.c
@@ -600,3 +600,16 @@ int Curl_ssl_check_cxn(struct connectdata *conn)
return -1; /* connection status unknown */
#endif /* USE_SSLEAY */
}
+
+bool Curl_ssl_data_pending(struct connectdata *conn,
+ int connindex)
+{
+#ifdef USE_SSLEAY
+ /* OpenSSL-specific */
+ if(conn->ssl[connindex].handle)
+ /* SSL is in use */
+ return SSL_pending(conn->ssl[connindex].handle);
+#endif
+ return FALSE; /* nothing pending */
+
+}
diff --git a/lib/sslgen.h b/lib/sslgen.h
index 11dea3243..d4b05b243 100644
--- a/lib/sslgen.h
+++ b/lib/sslgen.h
@@ -71,9 +71,13 @@ int Curl_ssl_check_cxn(struct connectdata *conn);
CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
+bool Curl_ssl_data_pending(struct connectdata *conn,
+ int connindex);
+
#if !defined(USE_SSL) && !defined(SSLGEN_C)
/* set up blank macros for none-SSL builds */
#define Curl_ssl_close_all(x)
+#define Curl_ssl_data_pending(x) 0
#endif
#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
diff --git a/lib/transfer.c b/lib/transfer.c
index 45117c709..d89dec673 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -273,20 +273,10 @@ CURLcode Curl_readrewind(struct connectdata *conn)
return CURLE_OK;
}
-#ifdef USE_SSLEAY
-/* FIX: this is nasty OpenSSL-specific code that really shouldn't be here */
static int data_pending(struct connectdata *conn)
{
- if(conn->ssl[FIRSTSOCKET].handle)
- /* SSL is in use */
- return SSL_pending(conn->ssl[FIRSTSOCKET].handle);
-
- return 0; /* nothing */
+ return Curl_ssl_data_pending(conn, FIRSTSOCKET);
}
-#else
-/* non-SSL never have pending data */
-#define data_pending(x) 0
-#endif
#ifndef MIN
#define MIN(a,b) (a < b ? a : b)