diff --git a/websocketpp/transport/asio/security/tls.hpp b/websocketpp/transport/asio/security/tls.hpp index 7b32db814..e901bdd35 100644 --- a/websocketpp/transport/asio/security/tls.hpp +++ b/websocketpp/transport/asio/security/tls.hpp @@ -355,8 +355,13 @@ class connection : public lib::enable_shared_from_this { template lib::error_code translate_ec(ErrorCodeType ec) { if (ec.category() == lib::asio::error::get_ssl_category()) { +#if defined SSL_R_SHORT_READ if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) { return make_error_code(transport::error::tls_short_read); +#else + if (ERR_GET_REASON(ec.value()) == boost::asio::ssl::error::stream_truncated) { + return make_error_code(boost::asio::ssl::error::stream_truncated); +#endif } else { // We know it is a TLS related error, but otherwise don't know // more. Pass through as TLS generic.