protocol = myuri.GetScheme();
\end{verbatim}
+\membersection{Deviations from the RFC}\label{deviationsfromrfc}
+
+Note that on URIs with a "file" scheme wxURI does not
+parse the userinfo, server, or port portion. This is to keep
+compatability with wxFileSystem, the old wxURL, and older url specifications.
+
\membersection{wxURI::wxURI}\label{wxuriwxuri}
\func{}{wxURI}{\void}
// authority = [ userinfo "@" ] host [ ":" port ]
if (*uri == wxT('/') && *(uri+1) == wxT('/'))
{
+ //skip past the two slashes
uri += 2;
+ // ############# DEVIATION FROM RFC #########################
+ // Don't parse the server component for file URIs
+ if(m_scheme != wxT("file"))
+ {
+ //normal way
uri = ParseUserInfo(uri);
uri = ParseServer(uri);
return ParsePort(uri);
+ }
}
return uri;
CPPUNIT_TEST( Assignment );
CPPUNIT_TEST( Comparison );
CPPUNIT_TEST( Unescaping );
+ CPPUNIT_TEST( FileScheme );
#if TEST_URL
CPPUNIT_TEST( URLCompat );
#if wxUSE_PROTOCOL_HTTP
void Assignment();
void Comparison();
void Unescaping();
+ void FileScheme();
#if TEST_URL
void URLCompat();
CPPUNIT_ASSERT(works2.IsSameAs(broken2));
}
+
+void URITestCase::FileScheme()
+{
+ //file:// variety (NOT CONFORMANT TO THE RFC)
+ CPPUNIT_ASSERT(wxURI(wxString(wxT("file://e:/wxcode/script1.xml"))).GetPath()
+ == wxT("e:/wxcode/script1.xml") );
+
+ //file:/// variety
+ CPPUNIT_ASSERT(wxURI(wxString(wxT("file:///e:/wxcode/script1.xml"))).GetPath()
+ == wxT("/e:/wxcode/script1.xml") );
+
+ //file:/ variety
+ CPPUNIT_ASSERT(wxURI(wxString(wxT("file:/e:/wxcode/script1.xml"))).GetPath()
+ == wxT("/e:/wxcode/script1.xml") );
+
+ //file: variety
+ CPPUNIT_ASSERT(wxURI(wxString(wxT("file:e:/wxcode/script1.xml"))).GetPath()
+ == wxT("e:/wxcode/script1.xml") );
+}
+
#if TEST_URL
const wxChar* pszProblemUrls[] = { wxT("http://www.csdn.net"),