Do not attempt to download signature file, if download of update info failed already.
This commit is contained in:
parent
c3fc0f4cc0
commit
a76b1b13b1
@ -473,23 +473,17 @@ bool UpdateCheckThread::tryUpdateMirror(UpdateInfo *updateInfo, const QString &u
|
|||||||
bool success = false;
|
bool success = false;
|
||||||
log("", "Trying mirror:", url);
|
log("", "Trying mirror:", url);
|
||||||
|
|
||||||
QString randPart = x264_rand_str();
|
const QString randPart = x264_rand_str();
|
||||||
QString outFileVersionInfo = QString("%1/%2.ver").arg(x264_temp_directory(), randPart);
|
const QString outFileVers = QString("%1/%2.ver").arg(x264_temp_directory(), randPart);
|
||||||
QString outFileSignature = QString("%1/%2.sig").arg(x264_temp_directory(), randPart);
|
const QString outFileSign = QString("%1/%2.sig").arg(x264_temp_directory(), randPart);
|
||||||
|
|
||||||
log("", "Downloading update info:");
|
if(getUpdateInfo(url, outFileVers, outFileSign))
|
||||||
bool ok1 = getFile(QString("%1%2").arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileVersionInfo);
|
|
||||||
|
|
||||||
log("", "Downloading signature:");
|
|
||||||
bool ok2 = getFile(QString("%1%2.sig").arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileSignature);
|
|
||||||
|
|
||||||
if(ok1 && ok2)
|
|
||||||
{
|
{
|
||||||
log("", "Download okay, checking signature:");
|
log("", "Download okay, checking signature:");
|
||||||
if(checkSignature(outFileVersionInfo, outFileSignature))
|
if(checkSignature(outFileVers, outFileSign))
|
||||||
{
|
{
|
||||||
log("", "Signature okay, parsing info:");
|
log("", "Signature okay, parsing info:");
|
||||||
success = parseVersionInfo(outFileVersionInfo, updateInfo);
|
success = parseVersionInfo(outFileVers, updateInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -501,12 +495,29 @@ bool UpdateCheckThread::tryUpdateMirror(UpdateInfo *updateInfo, const QString &u
|
|||||||
log("", "Download has failed!");
|
log("", "Download has failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile::remove(outFileVersionInfo);
|
QFile::remove(outFileVers);
|
||||||
QFile::remove(outFileSignature);
|
QFile::remove(outFileSign);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UpdateCheckThread::getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign)
|
||||||
|
{
|
||||||
|
log("", "Downloading update info:");
|
||||||
|
if(!getFile(QString("%1%2" ).arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileVers))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
log("", "Downloading signature:");
|
||||||
|
if(!getFile(QString("%1%2.sig").arg(url, mirror_url_postfix[m_betaUpdates ? 1 : 0]), outFileSign))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool UpdateCheckThread::getFile(const QString &url, const QString &outFile, unsigned int maxRedir, bool *httpOk)
|
bool UpdateCheckThread::getFile(const QString &url, const QString &outFile, unsigned int maxRedir, bool *httpOk)
|
||||||
{
|
{
|
||||||
QFileInfo output(outFile);
|
QFileInfo output(outFile);
|
||||||
|
@ -101,6 +101,7 @@ private:
|
|||||||
inline void log(const QString &str1, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString());
|
inline void log(const QString &str1, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString());
|
||||||
|
|
||||||
bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5, bool *httpOk = NULL);
|
bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5, bool *httpOk = NULL);
|
||||||
|
bool getUpdateInfo(const QString &url, const QString &outFileVers, const QString &outFileSign);
|
||||||
int tryContactHost(const QString &url);
|
int tryContactHost(const QString &url);
|
||||||
bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
|
bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
|
||||||
bool checkSignature(const QString &file, const QString &signature);
|
bool checkSignature(const QString &file, const QString &signature);
|
||||||
|
Loading…
Reference in New Issue
Block a user