summaryrefslogtreecommitdiffstats
path: root/logic/net/CacheDownload.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-12-12 00:44:55 +0100
committerPetr Mrázek <peterix@gmail.com>2014-12-12 00:44:55 +0100
commitbbcd44a65784a1d775c4192b407b208c99520f23 (patch)
treec5153bf886f2fd0471f42c4eee48f13e4193b8a7 /logic/net/CacheDownload.cpp
parenta060d79c123e98baad8f1ea48600bd7449c9c66a (diff)
downloadMultiMC-bbcd44a65784a1d775c4192b407b208c99520f23.tar
MultiMC-bbcd44a65784a1d775c4192b407b208c99520f23.tar.gz
MultiMC-bbcd44a65784a1d775c4192b407b208c99520f23.tar.lz
MultiMC-bbcd44a65784a1d775c4192b407b208c99520f23.tar.xz
MultiMC-bbcd44a65784a1d775c4192b407b208c99520f23.zip
NOISSUE Always follow redirects for NetAction based downloads
Diffstat (limited to 'logic/net/CacheDownload.cpp')
-rw-r--r--logic/net/CacheDownload.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/logic/net/CacheDownload.cpp b/logic/net/CacheDownload.cpp
index 23214a98..b2fa4a12 100644
--- a/logic/net/CacheDownload.cpp
+++ b/logic/net/CacheDownload.cpp
@@ -101,28 +101,25 @@ void CacheDownload::downloadError(QNetworkReply::NetworkError error)
}
void CacheDownload::downloadFinished()
{
- if (m_followRedirects)
+ QVariant redirect = m_reply->header(QNetworkRequest::LocationHeader);
+ QString redirectURL;
+ if(redirect.isValid())
{
- QVariant redirect = m_reply->header(QNetworkRequest::LocationHeader);
- QString redirectURL;
- if(redirect.isValid())
- {
- redirectURL = redirect.toString();
- }
- // FIXME: This is a hack for https://bugreports.qt-project.org/browse/QTBUG-41061
- else if(m_reply->hasRawHeader("Location"))
- {
- auto data = m_reply->rawHeader("Location");
- if(data.size() > 2 && data[0] == '/' && data[1] == '/')
- redirectURL = m_reply->url().scheme() + ":" + data;
- }
- if (!redirectURL.isEmpty())
- {
- m_url = QUrl(redirect.toString());
- QLOG_INFO() << "Following redirect to " << m_url.toString();
- start();
- return;
- }
+ redirectURL = redirect.toString();
+ }
+ // FIXME: This is a hack for https://bugreports.qt-project.org/browse/QTBUG-41061
+ else if(m_reply->hasRawHeader("Location"))
+ {
+ auto data = m_reply->rawHeader("Location");
+ if(data.size() > 2 && data[0] == '/' && data[1] == '/')
+ redirectURL = m_reply->url().scheme() + ":" + data;
+ }
+ if (!redirectURL.isEmpty())
+ {
+ m_url = QUrl(redirect.toString());
+ QLOG_INFO() << "Following redirect to " << m_url.toString();
+ start();
+ return;
}
// if the download succeeded