diff options
author | Jose <pepone@users.noreply.github.com> | 2022-07-05 17:17:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 17:17:44 +0200 |
commit | 998e2d258413c6693299c680c1edc539d88dc7dc (patch) | |
tree | 2fb5875f54654b62473669687cf8bac0eaddf630 /cpp/src | |
parent | Suppress doc warning when importing Ruby headers (#1376) (diff) | |
download | ice-998e2d258413c6693299c680c1edc539d88dc7dc.tar.bz2 ice-998e2d258413c6693299c680c1edc539d88dc7dc.tar.xz ice-998e2d258413c6693299c680c1edc539d88dc7dc.zip |
Handle SSL_R_UNEXPECTED_EOF_WHILE_READING error code (#1378)
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLTransceiverI.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp index 190e90398cb..3148bd155e3 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -399,10 +399,21 @@ OpenSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal:: } case SSL_ERROR_SSL: { - ostringstream ostr; - ostr << "SSL error occurred for new " << (_incoming ? "incoming" : "outgoing") - << " connection:\n" << _delegate->toString() << "\n" << _engine->sslErrors(); - throw ProtocolException(__FILE__, __LINE__, ostr.str()); +#if defined(SSL_R_UNEXPECTED_EOF_WHILE_READING) + if (SSL_R_UNEXPECTED_EOF_WHILE_READING == ERR_GET_REASON(ERR_get_error())) + { + throw ConnectionLostException(__FILE__, __LINE__, 0); + } + else + { +#endif + ostringstream ostr; + ostr << "SSL error occurred for new " << (_incoming ? "incoming" : "outgoing") + << " connection:\n" << _delegate->toString() << "\n" << _engine->sslErrors(); + throw ProtocolException(__FILE__, __LINE__, ostr.str()); +#if defined(SSL_R_UNEXPECTED_EOF_WHILE_READING) + } +#endif } } } @@ -748,8 +759,19 @@ OpenSSL::TransceiverI::read(IceInternal::Buffer& buf) } case SSL_ERROR_SSL: { - throw ProtocolException(__FILE__, __LINE__, - "SSL protocol error during read:\n" + _engine->sslErrors()); +#if defined(SSL_R_UNEXPECTED_EOF_WHILE_READING) + if (SSL_R_UNEXPECTED_EOF_WHILE_READING == ERR_GET_REASON(ERR_get_error())) + { + throw ConnectionLostException(__FILE__, __LINE__, 0); + } + else + { +#endif + throw ProtocolException(__FILE__, __LINE__, + "SSL protocol error during read:\n" + _engine->sslErrors()); +#if defined(SSL_R_UNEXPECTED_EOF_WHILE_READING) + } +#endif } } } |