aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp')
-rw-r--r--contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp574
1 files changed, 287 insertions, 287 deletions
diff --git a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp
index f4766ca6f9..a62fcd33d4 100644
--- a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp
+++ b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocket.cpp
@@ -1,287 +1,287 @@
-//
-// SecureStreamSocket.cpp
-//
-// Library: NetSSL_OpenSSL
-// Package: SSLSockets
-// Module: SecureStreamSocket
-//
-// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/Net/SecureStreamSocket.h"
-#include "Poco/Net/SecureStreamSocketImpl.h"
-#include "Poco/Net/SocketImpl.h"
-#include "Poco/Net/SSLManager.h"
-#include "Poco/Exception.h"
-
-
-using Poco::InvalidArgumentException;
-
-
-namespace Poco {
-namespace Net {
-
-
-SecureStreamSocket::SecureStreamSocket():
- StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
-{
-}
-
-
-SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
-}
-
-
-SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext, Session::Ptr pSession):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
- useSession(pSession);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address):
- StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
-{
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName):
- StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
-{
- static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext, Session::Ptr pSession):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
- useSession(pSession);
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
- static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession):
- StreamSocket(new SecureStreamSocketImpl(pContext))
-{
- static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
- useSession(pSession);
- connect(address);
-}
-
-
-SecureStreamSocket::SecureStreamSocket(const Socket& socket):
- StreamSocket(socket)
-{
- if (!dynamic_cast<SecureStreamSocketImpl*>(impl()))
- throw InvalidArgumentException("Cannot assign incompatible socket");
-}
-
-
-SecureStreamSocket::SecureStreamSocket(SocketImpl* pImpl):
- StreamSocket(pImpl)
-{
- if (!dynamic_cast<SecureStreamSocketImpl*>(impl()))
- throw InvalidArgumentException("Cannot assign incompatible socket");
-}
-
-
-SecureStreamSocket::~SecureStreamSocket()
-{
-}
-
-
-SecureStreamSocket& SecureStreamSocket::operator = (const Socket& socket)
-{
- if (dynamic_cast<SecureStreamSocketImpl*>(socket.impl()))
- StreamSocket::operator = (socket);
- else
- throw InvalidArgumentException("Cannot assign incompatible socket");
- return *this;
-}
-
-
-bool SecureStreamSocket::havePeerCertificate() const
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->havePeerCertificate();
-}
-
-
-X509Certificate SecureStreamSocket::peerCertificate() const
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->peerCertificate();
-}
-
-
-void SecureStreamSocket::setPeerHostName(const std::string& hostName)
-{
- static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
-}
-
-
-const std::string& SecureStreamSocket::getPeerHostName() const
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->getPeerHostName();
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), SSLManager::instance().defaultClientContext());
- SecureStreamSocket result(pImpl);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, Context::Ptr pContext)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
- SecureStreamSocket result(pImpl);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, Context::Ptr pContext, Session::Ptr pSession)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
- SecureStreamSocket result(pImpl);
- result.useSession(pSession);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), SSLManager::instance().defaultClientContext());
- SecureStreamSocket result(pImpl);
- result.setPeerHostName(peerHostName);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName, Context::Ptr pContext)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
- SecureStreamSocket result(pImpl);
- result.setPeerHostName(peerHostName);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName, Context::Ptr pContext, Session::Ptr pSession)
-{
- SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
- SecureStreamSocket result(pImpl);
- result.setPeerHostName(peerHostName);
- result.useSession(pSession);
- if (pImpl->context()->isForServerUse())
- pImpl->acceptSSL();
- else
- pImpl->connectSSL();
- return result;
-}
-
-
-Context::Ptr SecureStreamSocket::context() const
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->context();
-}
-
-
-void SecureStreamSocket::setLazyHandshake(bool flag)
-{
- static_cast<SecureStreamSocketImpl*>(impl())->setLazyHandshake(flag);
-}
-
-
-bool SecureStreamSocket::getLazyHandshake() const
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->getLazyHandshake();
-}
-
-
-void SecureStreamSocket::verifyPeerCertificate()
-{
- static_cast<SecureStreamSocketImpl*>(impl())->verifyPeerCertificate();
-}
-
-
-void SecureStreamSocket::verifyPeerCertificate(const std::string& hostName)
-{
- static_cast<SecureStreamSocketImpl*>(impl())->verifyPeerCertificate(hostName);
-}
-
-
-int SecureStreamSocket::completeHandshake()
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->completeHandshake();
-}
-
-
-Session::Ptr SecureStreamSocket::currentSession()
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->currentSession();
-}
-
-
-void SecureStreamSocket::useSession(Session::Ptr pSession)
-{
- static_cast<SecureStreamSocketImpl*>(impl())->useSession(pSession);
-}
-
-
-bool SecureStreamSocket::sessionWasReused()
-{
- return static_cast<SecureStreamSocketImpl*>(impl())->sessionWasReused();
-}
-
-
-void SecureStreamSocket::abort()
-{
- static_cast<SecureStreamSocketImpl*>(impl())->abort();
-}
-
-
-} } // namespace Poco::Net
+//
+// SecureStreamSocket.cpp
+//
+// Library: NetSSL_OpenSSL
+// Package: SSLSockets
+// Module: SecureStreamSocket
+//
+// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/Net/SecureStreamSocket.h"
+#include "Poco/Net/SecureStreamSocketImpl.h"
+#include "Poco/Net/SocketImpl.h"
+#include "Poco/Net/SSLManager.h"
+#include "Poco/Exception.h"
+
+
+using Poco::InvalidArgumentException;
+
+
+namespace Poco {
+namespace Net {
+
+
+SecureStreamSocket::SecureStreamSocket():
+ StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
+{
+}
+
+
+SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+}
+
+
+SecureStreamSocket::SecureStreamSocket(Context::Ptr pContext, Session::Ptr pSession):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+ useSession(pSession);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address):
+ StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
+{
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName):
+ StreamSocket(new SecureStreamSocketImpl(SSLManager::instance().defaultClientContext()))
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, Context::Ptr pContext, Session::Ptr pSession):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+ useSession(pSession);
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const SocketAddress& address, const std::string& hostName, Context::Ptr pContext, Session::Ptr pSession):
+ StreamSocket(new SecureStreamSocketImpl(pContext))
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
+ useSession(pSession);
+ connect(address);
+}
+
+
+SecureStreamSocket::SecureStreamSocket(const Socket& socket):
+ StreamSocket(socket)
+{
+ if (!dynamic_cast<SecureStreamSocketImpl*>(impl()))
+ throw InvalidArgumentException("Cannot assign incompatible socket");
+}
+
+
+SecureStreamSocket::SecureStreamSocket(SocketImpl* pImpl):
+ StreamSocket(pImpl)
+{
+ if (!dynamic_cast<SecureStreamSocketImpl*>(impl()))
+ throw InvalidArgumentException("Cannot assign incompatible socket");
+}
+
+
+SecureStreamSocket::~SecureStreamSocket()
+{
+}
+
+
+SecureStreamSocket& SecureStreamSocket::operator = (const Socket& socket)
+{
+ if (dynamic_cast<SecureStreamSocketImpl*>(socket.impl()))
+ StreamSocket::operator = (socket);
+ else
+ throw InvalidArgumentException("Cannot assign incompatible socket");
+ return *this;
+}
+
+
+bool SecureStreamSocket::havePeerCertificate() const
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->havePeerCertificate();
+}
+
+
+X509Certificate SecureStreamSocket::peerCertificate() const
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->peerCertificate();
+}
+
+
+void SecureStreamSocket::setPeerHostName(const std::string& hostName)
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->setPeerHostName(hostName);
+}
+
+
+const std::string& SecureStreamSocket::getPeerHostName() const
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->getPeerHostName();
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), SSLManager::instance().defaultClientContext());
+ SecureStreamSocket result(pImpl);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, Context::Ptr pContext)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
+ SecureStreamSocket result(pImpl);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, Context::Ptr pContext, Session::Ptr pSession)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
+ SecureStreamSocket result(pImpl);
+ result.useSession(pSession);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), SSLManager::instance().defaultClientContext());
+ SecureStreamSocket result(pImpl);
+ result.setPeerHostName(peerHostName);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName, Context::Ptr pContext)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
+ SecureStreamSocket result(pImpl);
+ result.setPeerHostName(peerHostName);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName, Context::Ptr pContext, Session::Ptr pSession)
+{
+ SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
+ SecureStreamSocket result(pImpl);
+ result.setPeerHostName(peerHostName);
+ result.useSession(pSession);
+ if (pImpl->context()->isForServerUse())
+ pImpl->acceptSSL();
+ else
+ pImpl->connectSSL();
+ return result;
+}
+
+
+Context::Ptr SecureStreamSocket::context() const
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->context();
+}
+
+
+void SecureStreamSocket::setLazyHandshake(bool flag)
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->setLazyHandshake(flag);
+}
+
+
+bool SecureStreamSocket::getLazyHandshake() const
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->getLazyHandshake();
+}
+
+
+void SecureStreamSocket::verifyPeerCertificate()
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->verifyPeerCertificate();
+}
+
+
+void SecureStreamSocket::verifyPeerCertificate(const std::string& hostName)
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->verifyPeerCertificate(hostName);
+}
+
+
+int SecureStreamSocket::completeHandshake()
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->completeHandshake();
+}
+
+
+Session::Ptr SecureStreamSocket::currentSession()
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->currentSession();
+}
+
+
+void SecureStreamSocket::useSession(Session::Ptr pSession)
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->useSession(pSession);
+}
+
+
+bool SecureStreamSocket::sessionWasReused()
+{
+ return static_cast<SecureStreamSocketImpl*>(impl())->sessionWasReused();
+}
+
+
+void SecureStreamSocket::abort()
+{
+ static_cast<SecureStreamSocketImpl*>(impl())->abort();
+}
+
+
+} } // namespace Poco::Net