fixed URL parsing problem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
1999-11-06 17:28:02 +00:00
parent 0e528b997e
commit 81915974f6

View File

@@ -70,7 +70,13 @@ class wxInetCacheNode : public wxObject
bool wxInternetFSHandler::CanOpen(const wxString& location)
{
wxString p = GetProtocol(location);
return (p == wxT("http")) || (p == wxT("ftp"));
if ((p == wxT("http")) || (p == wxT("ftp")))
{
wxURL url(GetProtocol(location) + wxT(":") + GetRightLocation(location));
return (url.GetError() == wxURL_NOERR);
}
else
return FALSE;
}
@@ -87,6 +93,8 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxStri
if (info == NULL)
{
wxURL url(right);
if (url.GetError() == wxURL_NOERR)
{
s = url.GetInputStream();
content = url.GetProtocol().GetContentType();
if (content == wxEmptyString) content = GetMimeTypeFromExt(location);
@@ -105,9 +113,10 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxStri
delete s;
}
else
{
return (wxFSFile*) NULL; // we can't open the URL
}
else
return (wxFSFile*) NULL; // incorrect URL
}
// Load item from cache: