NOISSUE Always follow redirects for NetAction based downloads

This commit is contained in:
Petr Mrázek 2014-12-12 00:44:55 +01:00
parent a060d79c12
commit bbcd44a657
6 changed files with 36 additions and 48 deletions

View File

@ -286,7 +286,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
auto action = CacheDownload::make(
QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta);
action->m_followRedirects = true;
skin_dls.append(action);
meta->stale = true;
}

View File

@ -114,7 +114,6 @@ void LegacyJarModPage::on_addForgeBtn_clicked()
{
NetJob *fjob = new NetJob("Forge download");
auto cacheDl = CacheDownload::make(forge->universal_url, entry);
cacheDl->m_followRedirects = true;
fjob->addNetAction(cacheDl);
ProgressDialog dlg(this);
dlg.exec(fjob);

View File

@ -57,8 +57,6 @@ void ByteArrayDownload::downloadError(QNetworkReply::NetworkError error)
}
void ByteArrayDownload::downloadFinished()
{
if (m_followRedirects)
{
QVariant redirect = m_reply->header(QNetworkRequest::LocationHeader);
QString redirectURL;
@ -80,7 +78,6 @@ void ByteArrayDownload::downloadFinished()
start();
return;
}
}
// if the download succeeded
if (m_status != Job_Failed)

View File

@ -33,8 +33,6 @@ public:
QString m_errorString;
bool m_followRedirects = false;
public
slots:
virtual void start();

View File

@ -100,8 +100,6 @@ void CacheDownload::downloadError(QNetworkReply::NetworkError error)
m_status = Job_Failed;
}
void CacheDownload::downloadFinished()
{
if (m_followRedirects)
{
QVariant redirect = m_reply->header(QNetworkRequest::LocationHeader);
QString redirectURL;
@ -123,7 +121,6 @@ void CacheDownload::downloadFinished()
start();
return;
}
}
// if the download succeeded
if (m_status == Job_Failed)

View File

@ -36,8 +36,6 @@ private:
bool wroteAnyData = false;
public:
bool m_followRedirects = false;
explicit CacheDownload(QUrl url, MetaEntryPtr entry);
static CacheDownloadPtr make(QUrl url, MetaEntryPtr entry)
{