Supports boringssl (SSL_R_SHORT_READ)

This commit is contained in:
Ryan Lee 2017-10-22 23:52:21 +09:00
parent 106dc45651
commit 3c73978688

View File

@ -355,13 +355,17 @@ protected:
template <typename ErrorCodeType> template <typename ErrorCodeType>
lib::error_code translate_ec(ErrorCodeType ec) { lib::error_code translate_ec(ErrorCodeType ec) {
if (ec.category() == lib::asio::error::get_ssl_category()) { if (ec.category() == lib::asio::error::get_ssl_category()) {
#ifdef SSL_R_SHORT_READ
if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) { if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) {
return make_error_code(transport::error::tls_short_read); return make_error_code(transport::error::tls_short_read);
} else { } else {
#endif
// We know it is a TLS related error, but otherwise don't know // We know it is a TLS related error, but otherwise don't know
// more. Pass through as TLS generic. // more. Pass through as TLS generic.
return make_error_code(transport::error::tls_error); return make_error_code(transport::error::tls_error);
#ifdef SSL_R_SHORT_READ
} }
#endif
} else { } else {
// We don't know any more information about this error so pass // We don't know any more information about this error so pass
// through // through