(openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl

This commit is contained in:
Benjamin Sergeant 2020-01-12 11:08:44 -08:00
parent a01584ad9d
commit d2c5ab1cc4
4 changed files with 40 additions and 50 deletions

View File

@ -1,6 +1,10 @@
# Changelog
All changes to this project will be documented in this file.
## [7.9.4] - 2020-01-12
(openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl
## [7.9.3] - 2020-01-10
(apple ssl) model write method after the OpenSSL one for consistency

View File

@ -229,10 +229,6 @@ namespace ix
}
ssize_t SocketMbedTLS::send(char* buf, size_t nbyte)
{
ssize_t sent = 0;
while (nbyte > 0)
{
std::lock_guard<std::mutex> lock(_mutex);
@ -240,8 +236,7 @@ namespace ix
if (res > 0)
{
nbyte -= res;
sent += res;
return res;
}
else if (res == MBEDTLS_ERR_SSL_WANT_READ || res == MBEDTLS_ERR_SSL_WANT_WRITE)
{
@ -253,8 +248,6 @@ namespace ix
return -1;
}
}
return sent;
}
ssize_t SocketMbedTLS::send(const std::string& buffer)
{

View File

@ -602,10 +602,6 @@ namespace ix
}
ssize_t SocketOpenSSL::send(char* buf, size_t nbyte)
{
ssize_t sent = 0;
while (nbyte > 0)
{
std::lock_guard<std::mutex> lock(_mutex);
@ -615,13 +611,12 @@ namespace ix
}
ERR_clear_error();
ssize_t write_result = SSL_write(_ssl_connection, buf + sent, (int) nbyte);
ssize_t write_result = SSL_write(_ssl_connection, buf, (int) nbyte);
int reason = SSL_get_error(_ssl_connection, (int) write_result);
if (reason == SSL_ERROR_NONE)
{
nbyte -= write_result;
sent += write_result;
return write_result;
}
else if (reason == SSL_ERROR_WANT_READ || reason == SSL_ERROR_WANT_WRITE)
{
@ -633,8 +628,6 @@ namespace ix
return -1;
}
}
return sent;
}
ssize_t SocketOpenSSL::send(const std::string& buffer)
{

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "7.9.3"
#define IX_WEBSOCKET_VERSION "7.9.4"