- wxString right = GetProtocol(location) + ":" + GetRightLocation(location);
- wxInputStream *s;
- wxString content;
- wxInetCacheNode *info;
-
- info = (wxInetCacheNode*) m_Cache.Get(right);
-
- // Add item into cache:
- if (info == NULL) {
- wxURL url(right);
- s = url.GetInputStream();
- content = url.GetProtocol().GetContentType();
- if (content == wxEmptyString) content = GetMimeTypeFromExt(location);
- if (s) {
- char buf[256];
-
- wxGetTempFileName("wxhtml", buf);
- info = new wxInetCacheNode(buf, content);
- m_Cache.Put(right, info);
-
- { // ok, now copy it:
- wxFileOutputStream sout(buf);
- s -> Read(sout); // copy the stream
+#if !wxUSE_URL
+ return NULL;
+#else
+ wxString right =
+ GetProtocol(location) + wxT(":") + StripProtocolAnchor(location);
+
+ wxURL url(right);
+ if (url.GetError() == wxURL_NOERR)
+ {
+ wxInputStream *s = url.GetInputStream();
+ wxString content = url.GetProtocol().GetContentType();
+ if (s)
+ {
+ wxString tmpfile =
+ wxFileName::CreateTempFileName(wxT("wxhtml"));
+
+ { // now copy streams content to temporary file:
+ wxFileOutputStream sout(tmpfile);
+ s->Read(sout);