fixed an SSL issue; doc fixes

This commit is contained in:
Guenter Obiltschnig
2010-11-24 08:37:28 +00:00
parent 69a219dfd6
commit 897a1428da
7 changed files with 94 additions and 57 deletions

View File

@@ -1,7 +1,7 @@
//
// SSLException.h
//
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SSLException.h#2 $
// $Id: //poco/1.3/NetSSL_OpenSSL/include/Poco/Net/SSLException.h#3 $
//
// Library: NetSSL_OpenSSL
// Package: SSLCore
@@ -52,6 +52,7 @@ POCO_DECLARE_EXCEPTION(NetSSL_API, SSLException, NetException)
POCO_DECLARE_EXCEPTION(NetSSL_API, SSLContextException, SSLException)
POCO_DECLARE_EXCEPTION(NetSSL_API, InvalidCertificateException, SSLException)
POCO_DECLARE_EXCEPTION(NetSSL_API, CertificateValidationException, SSLException)
POCO_DECLARE_EXCEPTION(NetSSL_API, SSLConnectionUnexpectedlyClosedException, SSLException)
} } // namespace Poco::Net

View File

@@ -1,7 +1,7 @@
//
// TimeServer.cpp
//
// $Id: //poco/1.3/NetSSL_OpenSSL/samples/HTTPSTimeServer/src/HTTPSTimeServer.cpp#4 $
// $Id: //poco/1.3/NetSSL_OpenSSL/samples/HTTPSTimeServer/src/HTTPSTimeServer.cpp#5 $
//
// This sample demonstrates the HTTPServer and related classes.
//
@@ -225,7 +225,7 @@ protected:
else
{
// get parameters from configuration file
unsigned short port = (unsigned short) config().getInt("HTTPSTimeServer.port", 9980);
unsigned short port = (unsigned short) config().getInt("HTTPSTimeServer.port", 9443);
std::string format(config().getString("HTTPSTimeServer.format", DateTimeFormat::SORTABLE_FORMAT));
// set-up a server socket

View File

@@ -1,7 +1,7 @@
//
// SSLException.cpp
//
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SSLException.cpp#2 $
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SSLException.cpp#3 $
//
// Library: NetSSL_OpenSSL
// Package: SSLCore
@@ -46,6 +46,7 @@ POCO_IMPLEMENT_EXCEPTION(SSLException, NetException, "SSL Exception")
POCO_IMPLEMENT_EXCEPTION(SSLContextException, SSLException, "SSL context exception")
POCO_IMPLEMENT_EXCEPTION(InvalidCertificateException, SSLException, "Invalid certficate")
POCO_IMPLEMENT_EXCEPTION(CertificateValidationException, SSLException, "Certificate validation error")
POCO_IMPLEMENT_EXCEPTION(SSLConnectionUnexpectedlyClosedException, SSLException, "SSL connection unexpectedly closed")
} } // namespace Poco::Net

View File

@@ -1,7 +1,7 @@
//
// SecureSocketImpl.cpp
//
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureSocketImpl.cpp#23 $
// $Id: //poco/1.3/NetSSL_OpenSSL/src/SecureSocketImpl.cpp#24 $
//
// Library: NetSSL_OpenSSL
// Package: SSLSockets
@@ -251,7 +251,9 @@ int SecureSocketImpl::sendBytes(const void* buffer, int length, int flags)
rc = completeHandshake();
if (rc == 1)
verifyPeerCertificate();
else
else if (rc == 0)
throw SSLConnectionUnexpectedlyClosedException();
else
return rc;
}
do
@@ -261,7 +263,8 @@ int SecureSocketImpl::sendBytes(const void* buffer, int length, int flags)
while (rc <= 0 && _pSocket->lastError() == POCO_EINTR);
if (rc <= 0)
{
return handleError(rc);
rc = handleError(rc);
if (rc == 0) throw SSLConnectionUnexpectedlyClosedException();
}
return rc;
}
@@ -403,7 +406,7 @@ int SecureSocketImpl::handleError(int rc)
{
if (rc == 0)
{
throw SSLException("The underlying socket connection has been unexpectedly closed");
throw SSLConnectionUnexpectedlyClosedException();
}
else
{