X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f80eabe5a2a9922c2c73d44b4037a2de8fffdf87..887dfc146ffd1c0d64afbb2fc9ad14a4f18ba60b:/src/common/url.cpp diff --git a/src/common/url.cpp b/src/common/url.cpp index c2e863f0b4..e265e0c5f3 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -6,10 +6,10 @@ // 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 @@ -20,8 +20,7 @@ #pragma hdrstop #endif -#include -#include +#if wxUSE_URL #include "wx/string.h" #include "wx/list.h" @@ -29,6 +28,9 @@ #include "wx/module.h" #include "wx/url.h" +#include +#include + IMPLEMENT_CLASS(wxProtoInfo, wxObject) IMPLEMENT_CLASS(wxURL, wxObject) @@ -63,7 +65,7 @@ wxURL::wxURL(const wxString& url) #if wxUSE_SOCKETS if ( ms_useDefaultProxy && !ms_proxyDefault ) { - SetDefaultProxy(getenv("HTTP_PROXY")); + SetDefaultProxy( wxGetenv(wxT("HTTP_PROXY")) ); if ( !ms_proxyDefault ) { @@ -270,8 +272,6 @@ bool wxURL::FetchProtocol() wxInputStream *wxURL::GetInputStream() { - wxInputStream *the_i_stream = NULL; - if (!m_protocol) { m_error = wxURL_NOPROTO; @@ -308,10 +308,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) { @@ -385,7 +384,7 @@ void wxURL::SetProxy(const wxString& url_proxy) 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); @@ -462,12 +461,16 @@ wxString wxURL::ConvertFromURI(const wxString& uri) 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')); @@ -521,3 +524,6 @@ void wxURLModule::OnExit() } #endif // wxUSE_SOCKETS + +#endif // wxUSE_URL +