|
|
|
@ -20,11 +20,16 @@ |
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
*/ |
|
|
|
|
|
|
|
#include <openssl/err.h> |
|
|
|
#include <openssl/ssl.h> |
|
|
|
#include <unistd.h> |
|
|
|
#include <errno.h> |
|
|
|
|
|
|
|
#include "stream.h" |
|
|
|
#include "logger.h" |
|
|
|
|
|
|
|
extern Logger logger; |
|
|
|
|
|
|
|
|
|
|
|
ssize_t |
|
|
|
streamWrite(Stream this, void * buf, size_t count) |
|
|
|
@ -59,6 +64,29 @@ streamWrite(Stream this, void * buf, size_t count) |
|
|
|
|
|
|
|
case STREAM_SSL: |
|
|
|
done = SSL_write((this->handle).ssl, buf, count); |
|
|
|
|
|
|
|
if (0 >= done) { |
|
|
|
switch (SSL_get_error((this->handle).ssl, done)) { |
|
|
|
case SSL_ERROR_SSL: |
|
|
|
case SSL_ERROR_SYSCALL: |
|
|
|
{ |
|
|
|
unsigned long err; |
|
|
|
|
|
|
|
while (0 != (err = ERR_get_error())) { |
|
|
|
loggerLog( |
|
|
|
logger, |
|
|
|
LOGGER_DEBUG, |
|
|
|
ERR_error_string(err, NULL)); |
|
|
|
} |
|
|
|
} |
|
|
|
// DROP THROUGH |
|
|
|
|
|
|
|
case SSL_ERROR_ZERO_RETURN: |
|
|
|
done = -2; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|