- data->Read(sout);
- m_text->AppendText(_("Results written to file: test.url\n"));
- m_text->AppendText(_("Done.\n"));
- m_text->AppendText(_("=== URL test ends ===\n"));
+ // Try to get the input stream (connects to the given URL)
+ wxLogMessage("Establishing connection to \"%s\"...", urlname);
+ const std::auto_ptr<wxInputStream> data(url.GetInputStream());
+ if ( !data.get() )
+ {
+ wxLogError("Failed to retrieve URL \"%s\"", urlname);
+ return;
+ }
+
+ // Print the contents type and file size
+ wxLogMessage("Contents type: %s\nFile size: %i\nStarting to download...",
+ url.GetProtocol().GetContentType(),
+ data->GetSize());
+
+ // Get the data
+ wxStringOutputStream sout;
+ if ( data->Read(sout).GetLastError() != wxSTREAM_EOF )
+ wxLogError("Error reading the input stream.");