mirror of
https://github.com/brunoos/luasec.git
synced 2024-11-08 06:28:26 +01:00
Move the fix of SSL_get_error() in OpenSSL 1.1.1
Moving to lsec_socket_error() coverts better 'errno == 0' with SSL_ERROR_SYSCALL.
This commit is contained in:
parent
359151144b
commit
bdbc67b188
@ -48,4 +48,10 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if !defined(LIBRESSL_VERSION_NUMBER) && ((OPENSSL_VERSION_NUMBER & 0xFFFFF000L) == 0x10101000L)
|
||||
#define LSEC_OPENSSL_1_1_1
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
@ -48,6 +48,11 @@ static int lsec_socket_error()
|
||||
#if defined(WIN32)
|
||||
return WSAGetLastError();
|
||||
#else
|
||||
#if defined(LSEC_OPENSSL_1_1_1)
|
||||
// Bug in OpenSSL 1.1.1
|
||||
if (errno == 0)
|
||||
return LSEC_IO_SSL;
|
||||
#endif
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
@ -182,10 +187,6 @@ static int ssl_send(void *ctx, const char *data, size_t count, size_t *sent,
|
||||
ssl->error = SSL_ERROR_SSL;
|
||||
return LSEC_IO_SSL;
|
||||
}
|
||||
/* Return failure when SSL reports syscall error
|
||||
* but errno is not set to break send operation. */
|
||||
if (errno == 0)
|
||||
return LSEC_IO_SSL;
|
||||
if (err == 0)
|
||||
return IO_CLOSED;
|
||||
return lsec_socket_error();
|
||||
|
Loading…
Reference in New Issue
Block a user