From 9899bb5bef85c5a97f525b21681acf0a69cbbc17 Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Garcia Date: Sat, 8 Apr 2000 11:19:50 +0000 Subject: [PATCH] A couple of changes related to the way that URLs are parsed to form a valid URI in the wxURL::ConvertToValidURI function. Modified to comply with RFC2396 as much as possible, see comments in the code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/url.h | 16 ++++++++++------ src/common/url.cpp | 25 ++++++++++++++++++++----- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/wx/url.h b/include/wx/url.h index 6b15187585..b941e10e16 100644 --- a/include/wx/url.h +++ b/include/wx/url.h @@ -8,6 +8,7 @@ // Copyright: (c) 1997, 1998 Guilhem Lavaux // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// + #ifndef _WX_URL_H #define _WX_URL_H @@ -42,11 +43,11 @@ public: virtual ~wxURL(); wxString GetProtocolName() const { return m_protoinfo->m_protoname; } - wxString GetHostName() const { return m_hostname; } - wxString GetURL() const { return m_url; } - wxProtocol& GetProtocol() { return *m_protocol; } - wxURLError GetError() const { return m_error; } - wxString GetPath() const { return m_path; } + wxString GetHostName() const { return m_hostname; } + wxString GetURL() const { return m_url; } + wxProtocol& GetProtocol() { return *m_protocol; } + wxURLError GetError() const { return m_error; } + wxString GetPath() const { return m_path; } wxInputStream *GetInputStream(); @@ -55,7 +56,10 @@ public: void SetProxy(const wxString& url_proxy); #endif // wxUSE_SOCKETS - static wxString ConvertToValidURI(const wxString& uri); + static wxString ConvertToValidURI( + const wxString& uri, + const wxChar* delims = wxT(";/?:@&=+$,") + ); static wxString ConvertFromURI(const wxString& uri); protected: diff --git a/src/common/url.cpp b/src/common/url.cpp index ed6ca3a890..b6c54cca45 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -398,23 +398,37 @@ void wxURL::SetProxy(const wxString& url_proxy) } #endif // wxUSE_SOCKETS -wxString wxURL::ConvertToValidURI(const wxString& uri) +wxString wxURL::ConvertToValidURI(const wxString& uri, const wxChar* delims) { wxString out_str; wxString hexa_code; size_t i; - for (i=0;i