summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <pepone@users.noreply.github.com>2022-07-05 17:17:44 +0200
committerGitHub <noreply@github.com>2022-07-05 17:17:44 +0200
commit998e2d258413c6693299c680c1edc539d88dc7dc (patch)
tree2fb5875f54654b62473669687cf8bac0eaddf630 /cpp/src
parentSuppress doc warning when importing Ruby headers (#1376) (diff)
downloadice-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.cpp34
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
}
}
}