From 61b1167ab373533f4fa7895754c73adc4ad08ca6 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 19 Jun 2021 22:21:23 +0200 Subject: [PATCH] Correctly set environment variable CURL_CA_BUNDLE. --- src/UpdateChecker.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/UpdateChecker.cpp b/src/UpdateChecker.cpp index a29f0cc..47183e0 100644 --- a/src/UpdateChecker.cpp +++ b/src/UpdateChecker.cpp @@ -102,12 +102,14 @@ static QQueue buildRandomList(const char *const *values) return list; } -static const QHash *initEnvVars(void) +static const QHash *initEnvVars(const QString &binCurl) { - const QString tempfolder = QDir::toNativeSeparators(MUtils::temp_folder()); QHash *const environment = new QHash(); + const QString tempfolder = QDir::toNativeSeparators(MUtils::temp_folder()); environment->insert(QLatin1String("CURL_HOME"), 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; } @@ -152,12 +154,12 @@ MUtils::UpdateChecker::UpdateChecker(const QString &binCurl, const QString &binG m_binaryCurl(binCurl), m_binaryGnuPG(binGnuPG), m_binaryKeys(binKeys), + m_environment(initEnvVars(binCurl)), m_applicationId(applicationId), m_installedBuildNo(installedBuildNo), m_betaUpdates(betaUpdates), m_testMode(testMode), - m_maxProgress(MIN_CONNSCORE + 5), - m_environment(initEnvVars()) + m_maxProgress(MIN_CONNSCORE + 5) { m_status = UpdateStatus_NotStartedYet; 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 << "--max-redirs" << QString::number(maxRedir); args << "-A" << USER_AGENT_STR;