// Created: 20/07/1997
// RCS-ID: $Id$
// Copyright: (c) 1997, 1998 Guilhem Lavaux
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "url.h"
#endif
#pragma hdrstop
#endif
-#include <string.h>
-#include <ctype.h>
+#if wxUSE_URL
#include "wx/string.h"
#include "wx/list.h"
#include "wx/module.h"
#include "wx/url.h"
+#include <string.h>
+#include <ctype.h>
+
IMPLEMENT_CLASS(wxProtoInfo, wxObject)
IMPLEMENT_CLASS(wxURL, wxObject)
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 )
{
- SetDefaultProxy(getenv("HTTP_PROXY"));
+ SetDefaultProxy( wxGetenv(wxT("HTTP_PROXY")) );
if ( !ms_proxyDefault )
{
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)
{
return;
hostname = tmp_str(0, pos);
- port = tmp_str(pos, tmp_str.Length()-pos);
+ port = tmp_str(pos+1, tmp_str.Length()-pos);
addr.Hostname(hostname);
addr.Service(port);
i++;
if (uri[i] >= wxT('A') && uri[i] <= wxT('F'))
code = (uri[i] - wxT('A') + 10) * 16;
+ else if (uri[i] >= wxT('a') && uri[i] <= wxT('f'))
+ code = (uri[i] - wxT('a') + 10) * 16;
else
code = (uri[i] - wxT('0')) * 16;
i++;
if (uri[i] >= wxT('A') && uri[i] <= wxT('F'))
code += (uri[i] - wxT('A')) + 10;
+ else if (uri[i] >= wxT('a') && uri[i] <= wxT('f'))
+ code += (uri[i] - wxT('a')) + 10;
else
code += (uri[i] - wxT('0'));
}
#endif // wxUSE_SOCKETS
+
+#endif // wxUSE_URL
+