00001 // $Id: HTTPS_URL.cpp 91118 2010-07-17 10:29:57Z mcorino $ 00002 00003 #include "ace/INet/HTTPS_URL.h" 00004 00005 #if !defined (__ACE_INLINE__) 00006 #include "ace/INet/HTTPS_URL.inl" 00007 #endif 00008 00009 #include "ace/INet/String_IOStream.h" 00010 #include "ace/INet/HTTP_ClientRequestHandler.h" 00011 00012 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 namespace ACE 00015 { 00016 namespace HTTPS 00017 { 00018 const char* URL::PROTOCOL = "https"; 00019 00020 const ACE_CString& URL::protocol () 00021 { 00022 static const ACE_CString protocol_ (PROTOCOL); 00023 return protocol_; 00024 } 00025 00026 URL::URL () 00027 : ACE::HTTP::URL (HTTPS_PORT) 00028 { 00029 } 00030 00031 URL::URL (const ACE_CString& url_string) 00032 : ACE::HTTP::URL (HTTPS_PORT) 00033 { 00034 this->parse (url_string); 00035 } 00036 00037 URL::URL (const URL& url) 00038 : ACE::HTTP::URL (0) 00039 { 00040 *this = url; 00041 } 00042 00043 URL::~URL () 00044 { 00045 } 00046 00047 URL& URL::operator =(const URL& url) 00048 { 00049 ACE::HTTP::URL::operator=(url); 00050 return *this; 00051 } 00052 00053 ACE_CString URL::get_request_uri () const 00054 { 00055 ACE::IOS::CString_OStream sos; 00056 #if 0 00057 if (!this->proxy_host_.empty ()) 00058 { 00059 sos << this->get_scheme ().c_str () << "://" 00060 << ACE::INet::URL_INetBase::get_host ().c_str (); 00061 if (ACE::INet::URL_INetBase::get_port () != HTTP_PORT) 00062 { 00063 sos << ':' << ACE::INet::URL_INetBase::get_port (); 00064 } 00065 } 00066 #endif 00067 // if path is empty we're requesting the root 00068 sos << (this->get_path ().empty () ? 00069 "/" : 00070 this->get_path ().c_str ()); 00071 if (!this->get_query ().empty ()) 00072 sos << '?' << this->get_query ().c_str (); 00073 if (!this->get_fragment ().empty ()) 00074 sos << '#' << this->get_fragment ().c_str (); 00075 return sos.str (); 00076 } 00077 00078 ACE::INet::ClientRequestHandler* URL::create_default_request_handler () const 00079 { 00080 ACE::INet::ClientRequestHandler* prh = 0; 00081 ACE_NEW_NORETURN (prh, ACE::HTTP::ClientRequestHandler ()); 00082 return prh; 00083 } 00084 00085 const URL::Factory& URL::factory_ = *URL::TURLFactorySingleton::instance (); 00086 00087 URL::Factory::Factory () 00088 { 00089 ACE::INet::URL_Base::register_factory (this); 00090 } 00091 00092 URL::Factory::~Factory () 00093 {} 00094 00095 const ACE_CString& URL::Factory::protocol () 00096 { 00097 return URL::protocol (); 00098 } 00099 00100 ACE::INet::URL_Base* URL::Factory::create_from_string (const ACE_CString& url_string) 00101 { 00102 URL* purl = 0; 00103 ACE_NEW_NORETURN (purl, URL (url_string)); 00104 return purl; 00105 } 00106 } 00107 } 00108 00109 ACE_END_VERSIONED_NAMESPACE_DECL