00001 // $Id: HTTPS_SessionFactory.cpp 91118 2010-07-17 10:29:57Z mcorino $ 00002 00003 #include "ace/INet/HTTPS_SessionFactory.h" 00004 00005 #include "ace/INet/INet_Log.h" 00006 00007 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00008 00009 namespace ACE 00010 { 00011 namespace HTTPS 00012 { 00013 00014 SessionFactory_Impl::SessionHolder_Impl::SessionHolder_Impl () 00015 : session_ (true) 00016 { 00017 } 00018 00019 SessionFactory_Impl::SessionHolder_Impl::~SessionHolder_Impl() 00020 { 00021 } 00022 00023 ACE::HTTP::SessionBase& SessionFactory_Impl::SessionHolder_Impl::session () 00024 { 00025 return this->session_; 00026 } 00027 00028 SessionFactory_Impl& SessionFactory_Impl::factory_ = 00029 *ACE_Singleton<SessionFactory_Impl,ACE_SYNCH::NULL_MUTEX>::instance (); 00030 00031 SessionFactory_Impl::SessionFactory_Impl () 00032 { 00033 INET_DEBUG (6, (LM_INFO, DLINFO 00034 ACE_TEXT ("HTTPS_SessionFactory_Impl::ctor - ") 00035 ACE_TEXT ("registering session factory for scheme [%C]\n"), 00036 URL::protocol ().c_str ())); 00037 ACE::HTTP::SessionFactoryRegistry::instance ().register_session_factory (URL::protocol (), this); 00038 } 00039 00040 SessionFactory_Impl::~SessionFactory_Impl () 00041 { 00042 } 00043 00044 ACE::INet::ConnectionHolder* 00045 SessionFactory_Impl::create_connection ( 00046 const ACE::INet::ConnectionKey& key) const 00047 { 00048 INET_TRACE ("HTTPS_SessionFactory_Impl::create_connection"); 00049 00050 const ACE::HTTP::ClientRequestHandler::HttpConnectionKey& ikey = 00051 dynamic_cast<const ACE::HTTP::ClientRequestHandler::HttpConnectionKey&> (key); 00052 00053 SessionHolder_Impl* session_holder = 0; 00054 ACE_NEW_RETURN (session_holder, 00055 SessionHolder_Impl (), 00056 0); 00057 ACE_Auto_Ptr<SessionHolder_Impl> session_safe_ref (session_holder); 00058 00059 (*session_holder)->set_host (ikey.host (), ikey.port ()); 00060 if (ikey.is_proxy_connection ()) 00061 { 00062 (*session_holder)->set_proxy_target (ikey.proxy_target_host (), 00063 ikey.proxy_target_port ()); 00064 } 00065 00066 if ((*session_holder)->connect (true)) 00067 { 00068 return session_safe_ref.release (); 00069 } 00070 00071 return 0; 00072 } 00073 00074 } 00075 } 00076 00077 ACE_END_VERSIONED_NAMESPACE_DECL