X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f61815af20ebb943000d36ea01489f6115e4061c..3372145d9daa42f680fc5aab7eb00e82d587c5a0:/src/common/url.cpp diff --git a/src/common/url.cpp b/src/common/url.cpp index 307bf7627f..a51ee7b273 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -20,8 +20,6 @@ #pragma hdrstop #endif -#if wxUSE_SOCKETS - #include #include @@ -37,7 +35,10 @@ IMPLEMENT_CLASS(wxURL, wxObject) // Protocols list wxProtoInfo *wxURL::g_protocols = NULL; + +#if wxUSE_SOCKETS wxHTTP *wxURL::g_proxy = NULL; +#endif // -------------------------------------------------------------- // wxURL @@ -52,8 +53,10 @@ wxURL::wxURL(const wxString& url) m_protocol = NULL; m_error = wxURL_NOERR; m_url = url; +#if wxUSE_SOCKETS m_useProxy = (g_proxy != NULL); m_proxy = g_proxy; +#endif ParseURL(); } @@ -96,6 +99,7 @@ bool wxURL::ParseURL() } // URL parse finished. +#if wxUSE_SOCKETS if (m_useProxy) { // We destroy the newly created protocol. CleanData(); @@ -110,6 +114,7 @@ bool wxURL::ParseURL() // We initialize specific variables. m_protocol = m_proxy; // FIXME: we should clone the protocol } +#endif m_error = wxURL_NOERR; return TRUE; @@ -117,15 +122,19 @@ bool wxURL::ParseURL() void wxURL::CleanData() { +#if wxUSE_SOCKETS if (!m_useProxy) +#endif delete m_protocol; } wxURL::~wxURL() { CleanData(); +#if wxUSE_SOCKETS if (m_proxy && m_proxy != g_proxy) delete m_proxy; +#endif } // -------------------------------------------------------------- @@ -233,7 +242,6 @@ bool wxURL::FetchProtocol() wxInputStream *wxURL::GetInputStream(void) { - wxIPV4address addr; wxInputStream *the_i_stream = NULL; if (!m_protocol) { @@ -247,6 +255,9 @@ wxInputStream *wxURL::GetInputStream(void) m_protocol->SetPassword(m_password); } +#if wxUSE_SOCKETS + wxIPV4address addr; + // m_protoinfo is NULL when we use a proxy if (!m_useProxy && m_protoinfo->m_needhost) { if (!addr.Hostname(m_hostname)) { @@ -262,6 +273,7 @@ wxInputStream *wxURL::GetInputStream(void) return NULL; } } +#endif // When we use a proxy, we have to pass the whole URL to it. if (m_useProxy) @@ -277,6 +289,7 @@ wxInputStream *wxURL::GetInputStream(void) return the_i_stream; } +#if wxUSE_SOCKETS void wxURL::SetDefaultProxy(const wxString& url_proxy) { if (url_proxy.IsNull()) { @@ -347,6 +360,7 @@ void wxURL::SetProxy(const wxString& url_proxy) m_useProxy = TRUE; ParseURL(); } +#endif wxString wxURL::ConvertToValidURI(const wxString& uri) { @@ -360,16 +374,14 @@ wxString wxURL::ConvertToValidURI(const wxString& uri) if (c == _T(' ')) out_str += _T('+'); else { - if (!isalpha(c) && c != _T('.') && c != _T('+') && c != _T('/')) { + if (!isalpha(c) && c != _T('.') && c != _T('+') && c != _T('/')) { hexa_code.Printf(_T("%%%02X"), c); out_str += hexa_code; } else out_str += c; } } - + return out_str; } -#endif - // wxUSE_SOCKETS