|
|
|
@ -60,6 +60,8 @@ bool QGCFileDownload::download(const QString& remoteFile, const QVector<QPair<QN
@@ -60,6 +60,8 @@ bool QGCFileDownload::download(const QString& remoteFile, const QVector<QPair<QN
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setIgnoreSSLErrorsIfNeeded(*networkReply); |
|
|
|
|
|
|
|
|
|
connect(networkReply, &QNetworkReply::downloadProgress, this, &QGCFileDownload::downloadProgress); |
|
|
|
|
connect(networkReply, &QNetworkReply::finished, this, &QGCFileDownload::_downloadFinished); |
|
|
|
|
connect(networkReply, &QNetworkReply::errorOccurred, this, &QGCFileDownload::_downloadError); |
|
|
|
@ -148,3 +150,19 @@ void QGCFileDownload::_downloadError(QNetworkReply::NetworkError code)
@@ -148,3 +150,19 @@ void QGCFileDownload::_downloadError(QNetworkReply::NetworkError code)
|
|
|
|
|
|
|
|
|
|
emit downloadComplete(_originalRemoteFile, QString(), errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void QGCFileDownload::setIgnoreSSLErrorsIfNeeded(QNetworkReply& networkReply) |
|
|
|
|
{ |
|
|
|
|
// Some systems (like Ubuntu 22.04) only ship with OpenSSL 3.x, however Qt 5.15.2 links against OpenSSL 1.x.
|
|
|
|
|
// This results in unresolved symbols for EVP_PKEY_base_id and SSL_get_peer_certificate.
|
|
|
|
|
// To still get a connection we have to ignore certificate verification (connection is still encrypted but open to MITM attacks)
|
|
|
|
|
// See https://bugreports.qt.io/browse/QTBUG-115146
|
|
|
|
|
const bool sslLibraryBuildIs1x = (QSslSocket::sslLibraryBuildVersionNumber() & 0xf0000000) == 0x10000000; |
|
|
|
|
const bool sslLibraryIs3x = (QSslSocket::sslLibraryVersionNumber() & 0xf0000000) == 0x30000000; |
|
|
|
|
if (sslLibraryBuildIs1x && sslLibraryIs3x) { |
|
|
|
|
qWarning() << "Ignoring ssl certificates due to OpenSSL version mismatch"; |
|
|
|
|
QList<QSslError> errorsThatCanBeIgnored; |
|
|
|
|
errorsThatCanBeIgnored << QSslError(QSslError::NoPeerCertificate); |
|
|
|
|
networkReply.ignoreSslErrors(errorsThatCanBeIgnored); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|