X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b60b2ec8ac57d569c4831eb98113f7cb713a117a..ba8546912daa12cea8076e08f1694a03e520dfe2:/src/common/url.cpp diff --git a/src/common/url.cpp b/src/common/url.cpp index 7d2da23724..2c30bffffc 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -54,6 +54,10 @@ USE_PROTOCOL(wxFTP) // // -------------------------------------------------------------- +// -------------------------------------------------------------- +// Construction +// -------------------------------------------------------------- + wxURL::wxURL(const wxString& url) : wxURI(url) { Init(url); @@ -62,23 +66,8 @@ wxURL::wxURL(const wxString& url) : wxURI(url) wxURL::wxURL(const wxURI& url) : wxURI(url) { - Init(url.Get()); - ParseURL(); -} - -wxURL& wxURL::operator = (const wxURI& url) -{ - wxURI::operator = (url); - Init(url.Get()); - ParseURL(); - return *this; -} -wxURL& wxURL::operator = (const wxString& url) -{ - wxURI::operator = (url); - Init(url); + Init(url.BuildURI()); ParseURL(); - return *this; } void wxURL::Init(const wxString& url) @@ -107,6 +96,26 @@ void wxURL::Init(const wxString& url) #endif // wxUSE_SOCKETS } + +// -------------------------------------------------------------- +// Assignment +// -------------------------------------------------------------- + +wxURL& wxURL::operator = (const wxURI& url) +{ + wxURI::operator = (url); + Init(url.BuildURI()); + ParseURL(); + return *this; +} +wxURL& wxURL::operator = (const wxString& url) +{ + wxURI::operator = (url); + Init(url); + ParseURL(); + return *this; +} + // -------------------------------------------------------------- // ParseURL // @@ -167,6 +176,10 @@ bool wxURL::ParseURL() return true; } +// -------------------------------------------------------------- +// Destruction/Cleanup +// -------------------------------------------------------------- + void wxURL::CleanData() { #if wxUSE_SOCKETS @@ -187,6 +200,9 @@ wxURL::~wxURL() #endif } +// -------------------------------------------------------------- +// FetchProtocol +// -------------------------------------------------------------- bool wxURL::FetchProtocol() { @@ -208,7 +224,7 @@ bool wxURL::FetchProtocol() } // -------------------------------------------------------------- -// --------- wxURL get ------------------------------------------ +// GetInputStream // -------------------------------------------------------------- wxInputStream *wxURL::GetInputStream() @@ -269,9 +285,24 @@ wxInputStream *wxURL::GetInputStream() #endif // When we use a proxy, we have to pass the whole URL to it. - wxInputStream *the_i_stream = - (m_useProxy) ? m_protocol->GetInputStream(m_url) : - m_protocol->GetInputStream(m_path); + wxInputStream *the_i_stream; + + if (!m_useProxy) + { + the_i_stream = m_protocol->GetInputStream(m_url); + } + else + { + wxString fullPath = m_path; + + if (HasQuery()) + fullPath += wxT("?") + m_query; + + if (HasFragment()) + fullPath += wxT("#") + m_fragment; + + the_i_stream = m_protocol->GetInputStream(fullPath); + } if (!the_i_stream) { @@ -365,6 +396,8 @@ void wxURL::SetProxy(const wxString& url_proxy) #endif // wxUSE_SOCKETS // ---------------------------------------------------------------------- +// wxURLModule +// // A module which deletes the default proxy if we created it // ----------------------------------------------------------------------