static void
getUrlToStream (const string &_url, io_stream *output)
{
- Log (LOG_BABBLE) << "getUrlToStream " << _url << endLog;
is_local_install = (source == IDC_SOURCE_LOCALDIR);
init_dialog (_url, 0);
NetIO *n = NetIO::open (_url.c_str(), true);
if (!n || !n->ok ())
{
delete n;
- Log (LOG_BABBLE) << "getUrlToStream failed!" << endLog;
throw new Exception (TOSTRING(__LINE__) " " __FILE__, "Error opening url", APPERR_IO_ERROR);
}
if (n)
delete (n);
/* reseeking is up to the recipient if desired */
+
+ Log (LOG_BABBLE) << "Fetched URL: " << _url << endLog;
}
io_stream *
io_stream_memory *membuf = new io_stream_memory ();
try
{
- Log (LOG_BABBLE) << "get_url_to_membuf " << _url << endLog;
getUrlToStream (_url, membuf);
if (membuf->seek (0, IO_SEEK_SET))
{
if (e->errNo() != APPERR_IO_ERROR)
throw e;
- Log (LOG_BABBLE) << "get_url_to_membuf failed!" << endLog;
delete membuf;
return 0;
}
if (!n || !n->ok ())
{
delete n;
- Log (LOG_BABBLE) << "get_url_to_file failed!" << endLog;
return 1;
}
#include "msg.h"
#include "netio.h"
#include "nio-ie5.h"
+#include "LogSingleton.h"
static HINTERNET internet_direct = 0;
static HINTERNET internet_preconfig = 0;
if (!connection)
{
- if (GetLastError () == ERROR_INTERNET_EXTENDED_ERROR)
+ DWORD e = GetLastError ();
+ if (e == ERROR_INTERNET_EXTENDED_ERROR)
{
char buf[2000];
DWORD e, l = sizeof (buf);
InternetGetLastResponseInfo (&e, buf, &l);
mbox (0, buf, "Internet Error", MB_OK);
}
+ else
+ {
+ Log (LOG_PLAIN) << "connection error: " << e << endLog;
+ }
}
DWORD type, type_s;
HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
&type, &type_s, NULL))
{
+ if (type != 200)
+ Log (LOG_PLAIN) << "HTTP status " << type << " fetching " << url << endLog;
+
if (type == 401) /* authorization required */
{
flush_io ();