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 )
#if wxUSE_SOCKETS
if (m_useProxy)
{
- // We destroy the newly created protocol.
- CleanData();
+ // destroy the previously created protocol as we'll be using m_proxy
+ delete m_protocol;
// Third, we rebuild the URL.
m_url = m_protoname + wxT(":");
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
}
wxInputStream *wxURL::GetInputStream()
{
- wxInputStream *the_i_stream = NULL;
-
if (!m_protocol)
{
m_error = wxURL_NOPROTO;
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;
#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)
{