diff options
Diffstat (limited to 'lib/qssl.c')
-rw-r--r-- | lib/qssl.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/qssl.c b/lib/qssl.c index 3d1b5da20..5a08a2559 100644 --- a/lib/qssl.c +++ b/lib/qssl.c @@ -374,8 +374,9 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex) } +/* for documentation see Curl_ssl_send() in sslgen.h */ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, - const void * mem, size_t len) + const void * mem, size_t len, int * curlcode) { /* SSL_Write() is said to return 'int' while write() and send() returns @@ -391,22 +392,26 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, /* The operation did not complete; the same SSL I/O function should be called again later. This is basicly an EWOULDBLOCK equivalent. */ - return 0; + *curlcode = -1; /* EWOULDBLOCK */ + return -1; case SSL_ERROR_IO: switch (errno) { case EWOULDBLOCK: case EINTR: - return 0; + *curlcode = -1; /* EWOULDBLOCK */ + return -1; } failf(conn->data, "SSL_Write() I/O error: %s", strerror(errno)); + *curlcode = CURLE_SEND_ERROR; return -1; } /* An SSL error. */ failf(conn->data, "SSL_Write() returned error %s", SSL_Strerror(rc, NULL)); + *curlcode = CURLE_SEND_ERROR; return -1; } @@ -414,8 +419,9 @@ ssize_t Curl_qsossl_send(struct connectdata * conn, int sockindex, } +/* for documentation see Curl_ssl_recv() in sslgen.h */ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf, - size_t buffersize, bool * wouldblock) + size_t buffersize, int * curlcode) { char error_buffer[120]; /* OpenSSL documents that this must be at @@ -426,7 +432,6 @@ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf, buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; nread = SSL_Read(conn->ssl[num].handle, buf, buffsize); - *wouldblock = FALSE; if(nread < 0) { /* failed SSL_read */ @@ -435,21 +440,23 @@ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf, case SSL_ERROR_BAD_STATE: /* there's data pending, re-invoke SSL_Read(). */ - *wouldblock = TRUE; - return -1; /* basically EWOULDBLOCK */ + *curlcode = -1; /* EWOULDBLOCK */ + return -1; case SSL_ERROR_IO: switch (errno) { case EWOULDBLOCK: - *wouldblock = TRUE; + *curlcode = -1; /* EWOULDBLOCK */ return -1; } failf(conn->data, "SSL_Read() I/O error: %s", strerror(errno)); + *curlcode = CURLE_RECV_ERROR; return -1; default: failf(conn->data, "SSL read error: %s", SSL_Strerror(nread, NULL)); + *curlcode = CURLE_RECV_ERROR; return -1; } } |