diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-11-25 14:22:36 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2011-11-28 13:14:52 +0100 |
commit | 15f0ba09ebafe6f9fefc3f7a90cc7190380fef07 (patch) | |
tree | c2f087bb65a1c19f9ac1609d383b935b7136436f /installerbuilder/libinstaller | |
parent | d174995a01d9c67251696d4920486b0d20da7c48 (diff) |
Move the proxy factory base class into the downloader factory.
Remove some now superfluous code to silently try the system proxy
in error case, as now we have a proxy factory set on every downloader.
Change-Id: I3399ea473d2958dbf97d2f0048b60922eb98c74f
Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller')
4 files changed, 29 insertions, 23 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp index 357abc8fc..4de001e12 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp @@ -1163,18 +1163,6 @@ void KDUpdater::HttpDownloader::httpReadyRead() void KDUpdater::HttpDownloader::httpError(QNetworkReply::NetworkError) { - static bool setProxySettings = false; - if (!d->retrying && !setProxySettings) { - d->shutDown(); - d->retrying = true; - setProxySettings = true; - - // silently force retry with global proxy settings - QNetworkProxyFactory::setUseSystemConfiguration(true); - - doDownload(); - return; - } httpDone(true); } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h index ff9d2be03..bdba0a859 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h @@ -31,7 +31,6 @@ #include <QtCore/QCryptographicHash> #include <QtNetwork/QAuthenticator> -#include <QtNetwork/QNetworkProxyFactory> namespace KDUpdater { @@ -39,12 +38,7 @@ KDTOOLS_EXPORT QByteArray calculateHash(QIODevice *device, QCryptographicHash::A KDTOOLS_EXPORT QByteArray calculateHash(const QString &path, QCryptographicHash::Algorithm algo); class HashVerificationJob; - -class KDTOOLS_EXPORT FileDownloaderProxyFactory : public QNetworkProxyFactory -{ - public: - virtual FileDownloaderProxyFactory *clone() = 0; -}; +class FileDownloaderProxyFactory; class KDTOOLS_EXPORT FileDownloader : public QObject { diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp index 7bad5c92f..a448d8765 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp @@ -42,7 +42,11 @@ using namespace KDUpdater; struct FileDownloaderFactory::FileDownloaderFactoryData { + FileDownloaderFactoryData() : m_factory(0) {} + ~FileDownloaderFactoryData() { delete m_factory; } + bool m_followRedirects; + FileDownloaderProxyFactory *m_factory; }; FileDownloaderFactory& FileDownloaderFactory::instance() @@ -65,14 +69,20 @@ FileDownloaderFactory::FileDownloaderFactory() d->m_followRedirects = false; } +bool FileDownloaderFactory::followRedirects() +{ + return FileDownloaderFactory::instance().d->m_followRedirects; +} + void FileDownloaderFactory::setFollowRedirects(bool val) { FileDownloaderFactory::instance().d->m_followRedirects = val; } -bool FileDownloaderFactory::followRedirects() +void FileDownloaderFactory::setProxyFactory(FileDownloaderProxyFactory *factory) { - return FileDownloaderFactory::instance().d->m_followRedirects; + delete FileDownloaderFactory::instance().d->m_factory; + FileDownloaderFactory::instance().d->m_factory = factory; } FileDownloaderFactory::~FileDownloaderFactory() @@ -95,8 +105,10 @@ FileDownloader *FileDownloaderFactory::create(const QString &scheme, const Signa { FileDownloader *downloader = KDGenericFactory<FileDownloader>::create(scheme); if (downloader != 0) { - downloader->setFollowRedirects(d->m_followRedirects); downloader->setParent(parent); + downloader->setFollowRedirects(d->m_followRedirects); + if (d->m_factory) + downloader->setProxyFactory(d->m_factory->clone()); } if (!verifier) return downloader; diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h index 3f40880d4..6fb100cc0 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h @@ -29,6 +29,8 @@ #include <QtCore/QStringList> #include <QtCore/QUrl> +#include <QtNetwork/QNetworkProxyFactory> + QT_BEGIN_NAMESPACE class QObject; QT_END_NAMESPACE @@ -38,6 +40,13 @@ namespace KDUpdater { class FileDownloader; class SignatureVerifier; +class KDTOOLS_EXPORT FileDownloaderProxyFactory : public QNetworkProxyFactory +{ + public: + virtual ~FileDownloaderProxyFactory() {} + virtual FileDownloaderProxyFactory *clone() const = 0; +}; + class KDTOOLS_EXPORT FileDownloaderFactory : public KDGenericFactory<FileDownloader> { Q_DISABLE_COPY(FileDownloaderFactory) @@ -54,8 +63,11 @@ public: FileDownloader *create(const QString &scheme, QObject *parent) const; FileDownloader *create(const QString &scheme, const SignatureVerifier *verifier = 0, const QUrl &signatureUrl = QUrl(), QObject *parent = 0) const; - static void setFollowRedirects(bool val); + static bool followRedirects(); + static void setFollowRedirects(bool val); + + static void setProxyFactory(FileDownloaderProxyFactory *factory); private: FileDownloaderFactory(); |