(openssl + mbedssl) fix #140, can send large files with ws send over ssl / still broken with apple ssl
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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) | ||||
|     { | ||||
|   | ||||
| @@ -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) | ||||
|     { | ||||
|   | ||||
| @@ -6,4 +6,4 @@ | ||||
|  | ||||
| #pragma once | ||||
|  | ||||
| #define IX_WEBSOCKET_VERSION "7.9.3" | ||||
| #define IX_WEBSOCKET_VERSION "7.9.4" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user