Correctly set environment variable CURL_CA_BUNDLE.

This commit is contained in:
LoRd_MuldeR 2021-06-19 22:21:23 +02:00
parent b526f1c566
commit 61b1167ab3

View File

@ -102,12 +102,14 @@ static QQueue<QString> buildRandomList(const char *const *values)
return list; return list;
} }
static const QHash<QString, QString> *initEnvVars(void) static const QHash<QString, QString> *initEnvVars(const QString &binCurl)
{ {
const QString tempfolder = QDir::toNativeSeparators(MUtils::temp_folder());
QHash<QString, QString> *const environment = new QHash<QString, QString>(); QHash<QString, QString> *const environment = new QHash<QString, QString>();
const QString tempfolder = QDir::toNativeSeparators(MUtils::temp_folder());
environment->insert(QLatin1String("CURL_HOME"), tempfolder); environment->insert(QLatin1String("CURL_HOME"), tempfolder);
environment->insert(QLatin1String("GNUPGHOME"), tempfolder); environment->insert(QLatin1String("GNUPGHOME"), tempfolder);
const QFileInfo curlFile(binCurl);
environment->insert(QLatin1String("CURL_CA_BUNDLE"), QDir::toNativeSeparators(curlFile.absoluteDir().absoluteFilePath(QString("%1.crt").arg(curlFile.completeBaseName()))));
return environment; return environment;
} }
@ -152,12 +154,12 @@ MUtils::UpdateChecker::UpdateChecker(const QString &binCurl, const QString &binG
m_binaryCurl(binCurl), m_binaryCurl(binCurl),
m_binaryGnuPG(binGnuPG), m_binaryGnuPG(binGnuPG),
m_binaryKeys(binKeys), m_binaryKeys(binKeys),
m_environment(initEnvVars(binCurl)),
m_applicationId(applicationId), m_applicationId(applicationId),
m_installedBuildNo(installedBuildNo), m_installedBuildNo(installedBuildNo),
m_betaUpdates(betaUpdates), m_betaUpdates(betaUpdates),
m_testMode(testMode), m_testMode(testMode),
m_maxProgress(MIN_CONNSCORE + 5), m_maxProgress(MIN_CONNSCORE + 5)
m_environment(initEnvVars())
{ {
m_status = UpdateStatus_NotStartedYet; m_status = UpdateStatus_NotStartedYet;
m_progress = 0; m_progress = 0;
@ -605,7 +607,7 @@ bool MUtils::UpdateChecker::getFile(const QUrl &url, const QString &outFile, con
} }
} }
QStringList args(QLatin1String("-vsSNqkfL")); QStringList args(QLatin1String("-vsSNqfL"));
args << "-m" << QString::number(DOWNLOAD_TIMEOUT / 1000); args << "-m" << QString::number(DOWNLOAD_TIMEOUT / 1000);
args << "--max-redirs" << QString::number(maxRedir); args << "--max-redirs" << QString::number(maxRedir);
args << "-A" << USER_AGENT_STR; args << "-A" << USER_AGENT_STR;