X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a03c55c13c674ea6f8489b764d5414a4979b348b..a63d48fa138e9eaa3079172ace9a804ba5b0415e:/src/common/url.cpp diff --git a/src/common/url.cpp b/src/common/url.cpp index 192c68fd3b..6c0da6ee29 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "url.h" #endif @@ -61,6 +61,9 @@ wxURL::wxURL(const wxString& url) m_protocol = NULL; m_error = wxURL_NOERR; m_url = url; +#if wxUSE_URL_NATIVE + m_nativeImp = CreateNativeImpObject(); +#endif #if wxUSE_SOCKETS if ( ms_useDefaultProxy && !ms_proxyDefault ) @@ -157,10 +160,13 @@ void wxURL::CleanData() wxURL::~wxURL() { - CleanData(); + CleanData(); #if wxUSE_SOCKETS - if (m_proxy && m_proxy != ms_proxyDefault) - delete m_proxy; + if (m_proxy && m_proxy != ms_proxyDefault) + delete m_proxy; +#endif +#if wxUSE_URL_NATIVE + delete m_nativeImp; #endif } @@ -272,8 +278,6 @@ bool wxURL::FetchProtocol() wxInputStream *wxURL::GetInputStream() { - wxInputStream *the_i_stream = NULL; - if (!m_protocol) { m_error = wxURL_NOPROTO; @@ -287,6 +291,19 @@ wxInputStream *wxURL::GetInputStream() m_protocol->SetPassword(m_password); } +#if wxUSE_URL_NATIVE + // give the native implementation to return a better stream + // such as the native WinINet functionality under MS-Windows + if (m_nativeImp) + { + wxInputStream *rc; + rc = m_nativeImp->GetInputStream(this); + if (rc != 0) + return rc; + } + // else use the standard behaviour +#endif // wxUSE_URL_NATIVE + #if wxUSE_SOCKETS wxIPV4address addr; @@ -310,10 +327,9 @@ wxInputStream *wxURL::GetInputStream() #endif // When we use a proxy, we have to pass the whole URL to it. - if (m_useProxy) - the_i_stream = m_protocol->GetInputStream(m_url); - else - the_i_stream = m_protocol->GetInputStream(m_path); + wxInputStream *the_i_stream = + (m_useProxy) ? m_protocol->GetInputStream(m_url) : + m_protocol->GetInputStream(m_path); if (!the_i_stream) {