Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / protocols / ace / INet / HTTPS_SessionFactory.cpp
blob8428341e61b76a62d49668a0871af5d2d099aaca
1 #include "ace/INet/HTTPS_SessionFactory.h"
3 #include "ace/INet/INet_Log.h"
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 namespace ACE
9 namespace HTTPS
11 SessionFactory_Impl::SessionHolder_Impl::SessionHolder_Impl ()
12 : session_ (true)
16 SessionFactory_Impl::SessionHolder_Impl::~SessionHolder_Impl()
20 ACE::HTTP::SessionBase& SessionFactory_Impl::SessionHolder_Impl::session ()
22 return this->session_;
25 SessionFactory_Impl& SessionFactory_Impl::factory_ =
26 *ACE_Singleton<SessionFactory_Impl,ACE_SYNCH::NULL_MUTEX>::instance ();
28 SessionFactory_Impl::SessionFactory_Impl ()
30 INET_DEBUG (6, (LM_INFO, DLINFO
31 ACE_TEXT ("HTTPS_SessionFactory_Impl::ctor - ")
32 ACE_TEXT ("registering session factory for scheme [%C]\n"),
33 URL::protocol ().c_str ()));
34 ACE::HTTP::SessionFactoryRegistry::instance ().register_session_factory (URL::protocol (), this);
37 SessionFactory_Impl::~SessionFactory_Impl ()
41 ACE::INet::ConnectionHolder*
42 SessionFactory_Impl::create_connection (
43 const ACE::INet::ConnectionKey& key) const
45 INET_TRACE ("HTTPS_SessionFactory_Impl::create_connection");
47 const ACE::HTTP::ClientRequestHandler::HttpConnectionKey& ikey =
48 dynamic_cast<const ACE::HTTP::ClientRequestHandler::HttpConnectionKey&> (key);
50 SessionHolder_Impl* session_holder = 0;
51 ACE_NEW_RETURN (session_holder,
52 SessionHolder_Impl (),
53 0);
54 std::unique_ptr<SessionHolder_Impl> session_safe_ref (session_holder);
56 (*session_holder)->set_host (ikey.host (), ikey.port ());
57 if (ikey.is_proxy_connection ())
59 (*session_holder)->set_proxy_target (ikey.proxy_target_host (),
60 ikey.proxy_target_port ());
63 if ((*session_holder)->connect (true))
65 return session_safe_ref.release ();
68 return 0;
74 ACE_END_VERSIONED_NAMESPACE_DECL