summaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp
diff options
context:
space:
mode:
authororivej <[email protected]>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp')
-rw-r--r--contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp376
1 files changed, 188 insertions, 188 deletions
diff --git a/contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp b/contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp
index 325f36a60a6..d8ffcc17b7e 100644
--- a/contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp
+++ b/contrib/libs/poco/NetSSL_OpenSSL/src/HTTPSClientSession.cpp
@@ -1,189 +1,189 @@
-//
-// HTTPSClientSession.cpp
-//
-// Library: NetSSL_OpenSSL
-// Package: HTTPSClient
-// Module: HTTPSClientSession
-//
-// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/Net/HTTPSClientSession.h"
-#include "Poco/Net/SecureStreamSocket.h"
-#include "Poco/Net/SecureStreamSocketImpl.h"
-#include "Poco/Net/SSLManager.h"
-#include "Poco/Net/SSLException.h"
-#include "Poco/Net/HTTPRequest.h"
-#include "Poco/Net/HTTPResponse.h"
-#include "Poco/Net/NetException.h"
-#include "Poco/NumberFormatter.h"
-
-
-using Poco::NumberFormatter;
-using Poco::IllegalStateException;
-
-
-namespace Poco {
-namespace Net {
-
-
-HTTPSClientSession::HTTPSClientSession():
- HTTPClientSession(SecureStreamSocket()),
- _pContext(SSLManager::instance().defaultClientContext())
-{
- setPort(HTTPS_PORT);
-}
-
-
-HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket):
- HTTPClientSession(socket),
- _pContext(socket.context())
-{
- setPort(HTTPS_PORT);
-}
-
-
-HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, Session::Ptr pSession):
- HTTPClientSession(socket),
- _pContext(socket.context()),
- _pSession(pSession)
-{
- setPort(HTTPS_PORT);
-}
-
-
-HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port):
- HTTPClientSession(SecureStreamSocket()),
- _pContext(SSLManager::instance().defaultClientContext())
-{
- setHost(host);
- setPort(port);
-}
-
-
-HTTPSClientSession::HTTPSClientSession(Context::Ptr pContext):
- HTTPClientSession(SecureStreamSocket(pContext)),
- _pContext(pContext)
-{
-}
-
-
-HTTPSClientSession::HTTPSClientSession(Context::Ptr pContext, Session::Ptr pSession):
- HTTPClientSession(SecureStreamSocket(pContext, pSession)),
- _pContext(pContext),
- _pSession(pSession)
-{
-}
-
-
-HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port, Context::Ptr pContext):
- HTTPClientSession(SecureStreamSocket(pContext)),
- _pContext(pContext)
-{
- setHost(host);
- setPort(port);
-}
-
-
-HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession):
- HTTPClientSession(SecureStreamSocket(pContext, pSession)),
- _pContext(pContext),
- _pSession(pSession)
-{
- setHost(host);
- setPort(port);
-}
-
-
-HTTPSClientSession::~HTTPSClientSession()
-{
-}
-
-
-bool HTTPSClientSession::secure() const
-{
- return true;
-}
-
-
-void HTTPSClientSession::abort()
-{
- SecureStreamSocket sss(socket());
- sss.abort();
-}
-
-
-X509Certificate HTTPSClientSession::serverCertificate()
-{
- SecureStreamSocket sss(socket());
- return sss.peerCertificate();
-}
-
-
-std::string HTTPSClientSession::proxyRequestPrefix() const
-{
- return std::string();
-}
-
-
-void HTTPSClientSession::proxyAuthenticate(HTTPRequest& request)
-{
-}
-
-
-void HTTPSClientSession::connect(const SocketAddress& address)
-{
- if (getProxyHost().empty() || bypassProxy())
- {
- SecureStreamSocket sss(socket());
- if (sss.getPeerHostName().empty())
- {
- sss.setPeerHostName(getHost());
- }
- if (_pContext->sessionCacheEnabled())
- {
- sss.useSession(_pSession);
- }
- HTTPSession::connect(address);
- if (_pContext->sessionCacheEnabled())
- {
- _pSession = sss.currentSession();
- }
- }
- else
- {
- StreamSocket proxySocket(proxyConnect());
- SecureStreamSocket secureSocket = SecureStreamSocket::attach(proxySocket, getHost(), _pContext, _pSession);
- attachSocket(secureSocket);
- if (_pContext->sessionCacheEnabled())
- {
- _pSession = secureSocket.currentSession();
- }
- }
-}
-
-
-int HTTPSClientSession::read(char* buffer, std::streamsize length)
-{
- try
- {
- return HTTPSession::read(buffer, length);
+//
+// HTTPSClientSession.cpp
+//
+// Library: NetSSL_OpenSSL
+// Package: HTTPSClient
+// Module: HTTPSClientSession
+//
+// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/Net/HTTPSClientSession.h"
+#include "Poco/Net/SecureStreamSocket.h"
+#include "Poco/Net/SecureStreamSocketImpl.h"
+#include "Poco/Net/SSLManager.h"
+#include "Poco/Net/SSLException.h"
+#include "Poco/Net/HTTPRequest.h"
+#include "Poco/Net/HTTPResponse.h"
+#include "Poco/Net/NetException.h"
+#include "Poco/NumberFormatter.h"
+
+
+using Poco::NumberFormatter;
+using Poco::IllegalStateException;
+
+
+namespace Poco {
+namespace Net {
+
+
+HTTPSClientSession::HTTPSClientSession():
+ HTTPClientSession(SecureStreamSocket()),
+ _pContext(SSLManager::instance().defaultClientContext())
+{
+ setPort(HTTPS_PORT);
+}
+
+
+HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket):
+ HTTPClientSession(socket),
+ _pContext(socket.context())
+{
+ setPort(HTTPS_PORT);
+}
+
+
+HTTPSClientSession::HTTPSClientSession(const SecureStreamSocket& socket, Session::Ptr pSession):
+ HTTPClientSession(socket),
+ _pContext(socket.context()),
+ _pSession(pSession)
+{
+ setPort(HTTPS_PORT);
+}
+
+
+HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port):
+ HTTPClientSession(SecureStreamSocket()),
+ _pContext(SSLManager::instance().defaultClientContext())
+{
+ setHost(host);
+ setPort(port);
+}
+
+
+HTTPSClientSession::HTTPSClientSession(Context::Ptr pContext):
+ HTTPClientSession(SecureStreamSocket(pContext)),
+ _pContext(pContext)
+{
+}
+
+
+HTTPSClientSession::HTTPSClientSession(Context::Ptr pContext, Session::Ptr pSession):
+ HTTPClientSession(SecureStreamSocket(pContext, pSession)),
+ _pContext(pContext),
+ _pSession(pSession)
+{
+}
+
+
+HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port, Context::Ptr pContext):
+ HTTPClientSession(SecureStreamSocket(pContext)),
+ _pContext(pContext)
+{
+ setHost(host);
+ setPort(port);
+}
+
+
+HTTPSClientSession::HTTPSClientSession(const std::string& host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession):
+ HTTPClientSession(SecureStreamSocket(pContext, pSession)),
+ _pContext(pContext),
+ _pSession(pSession)
+{
+ setHost(host);
+ setPort(port);
+}
+
+
+HTTPSClientSession::~HTTPSClientSession()
+{
+}
+
+
+bool HTTPSClientSession::secure() const
+{
+ return true;
+}
+
+
+void HTTPSClientSession::abort()
+{
+ SecureStreamSocket sss(socket());
+ sss.abort();
+}
+
+
+X509Certificate HTTPSClientSession::serverCertificate()
+{
+ SecureStreamSocket sss(socket());
+ return sss.peerCertificate();
+}
+
+
+std::string HTTPSClientSession::proxyRequestPrefix() const
+{
+ return std::string();
+}
+
+
+void HTTPSClientSession::proxyAuthenticate(HTTPRequest& request)
+{
+}
+
+
+void HTTPSClientSession::connect(const SocketAddress& address)
+{
+ if (getProxyHost().empty() || bypassProxy())
+ {
+ SecureStreamSocket sss(socket());
+ if (sss.getPeerHostName().empty())
+ {
+ sss.setPeerHostName(getHost());
+ }
+ if (_pContext->sessionCacheEnabled())
+ {
+ sss.useSession(_pSession);
+ }
+ HTTPSession::connect(address);
+ if (_pContext->sessionCacheEnabled())
+ {
+ _pSession = sss.currentSession();
+ }
}
- catch(SSLConnectionUnexpectedlyClosedException&)
- {
- return 0;
- }
-}
-
-
-Session::Ptr HTTPSClientSession::sslSession()
-{
- return _pSession;
-}
-
-
-} } // namespace Poco::Net
+ else
+ {
+ StreamSocket proxySocket(proxyConnect());
+ SecureStreamSocket secureSocket = SecureStreamSocket::attach(proxySocket, getHost(), _pContext, _pSession);
+ attachSocket(secureSocket);
+ if (_pContext->sessionCacheEnabled())
+ {
+ _pSession = secureSocket.currentSession();
+ }
+ }
+}
+
+
+int HTTPSClientSession::read(char* buffer, std::streamsize length)
+{
+ try
+ {
+ return HTTPSession::read(buffer, length);
+ }
+ catch(SSLConnectionUnexpectedlyClosedException&)
+ {
+ return 0;
+ }
+}
+
+
+Session::Ptr HTTPSClientSession::sslSession()
+{
+ return _pSession;
+}
+
+
+} } // namespace Poco::Net