diff options
author | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-04-04 17:43:03 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-04-07 04:43:52 +0000 |
commit | 80d1eb3dd7a577b92663c9bcd00f2614e9bd0a73 (patch) | |
tree | a1d8ed82df81aa4ca793ce320cc709c45b051fbd /src/libs/kdtools | |
parent | 4b652cdc1ac01390fb175889dee2e642f47aa360 (diff) |
Add a logging category and debug for http download
Sometimes installing fails due to a problem in server.
Since downloading can happen from mirror, it is hard to
detect where the problem is. Print the IP address where
the download actually happens to ease the problem solving.
Change-Id: I31e15c2b1926745c251093cd1663d1ca1c65bff6
Task-number: QTIFW-813
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r-- | src/libs/kdtools/filedownloader.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp index 508cc395d..c95eeeb94 100644 --- a/src/libs/kdtools/filedownloader.cpp +++ b/src/libs/kdtools/filedownloader.cpp @@ -51,6 +51,9 @@ #include <QSslError> #include <QBasicTimer> #include <QTimerEvent> +#include <QLoggingCategory> +#include <globals.h> +#include <QHostInfo> using namespace KDUpdater; using namespace QInstaller; @@ -1254,7 +1257,19 @@ void KDUpdater::HttpDownloader::httpReqFinished() } else { if (d->http == 0) return; - + const QUrl url = d->http->url(); + if (url.isValid() && QInstaller::lcNetwork().isDebugEnabled()){ + const QFileInfo fi(d->http->url().toString()); + if (fi.suffix() != QLatin1String("sha1")){ + const QString hostName = url.host(); + QHostInfo info = QHostInfo::fromName(hostName); + QStringList hostAddresses; + foreach (const QHostAddress &address, info.addresses()) + hostAddresses << address.toString(); + qCDebug(QInstaller::lcNetwork) << "Using host:" << hostName + << "for" << url.fileName() << "\nIP:" << hostAddresses; + } + } httpReadyRead(); d->destination->flush(); setDownloadCompleted(); |