1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 23:07:59 +00:00

Replace deprecated QSslSocket::setDefaultCiphers()

This commit is contained in:
Chocobo1 2019-02-27 15:23:56 +08:00
parent 168d3fbdac
commit c657134344
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -35,6 +35,7 @@
#include <QMutableListIterator> #include <QMutableListIterator>
#include <QNetworkProxy> #include <QNetworkProxy>
#include <QSslCipher> #include <QSslCipher>
#include <QSslConfiguration>
#include <QSslSocket> #include <QSslSocket>
#include <QStringList> #include <QStringList>
#include <QTimer> #include <QTimer>
@ -51,7 +52,7 @@ namespace
QList<QSslCipher> safeCipherList() QList<QSslCipher> safeCipherList()
{ {
const QStringList badCiphers {"idea", "rc4"}; const QStringList badCiphers {"idea", "rc4"};
const QList<QSslCipher> allCiphers {QSslSocket::supportedCiphers()}; const QList<QSslCipher> allCiphers {QSslConfiguration::supportedCiphers()};
QList<QSslCipher> safeCiphers; QList<QSslCipher> safeCiphers;
std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers), [&badCiphers](const QSslCipher &cipher) std::copy_if(allCiphers.cbegin(), allCiphers.cend(), std::back_inserter(safeCiphers), [&badCiphers](const QSslCipher &cipher)
{ {
@ -72,7 +73,10 @@ Server::Server(IRequestHandler *requestHandler, QObject *parent)
, m_https(false) , m_https(false)
{ {
setProxy(QNetworkProxy::NoProxy); setProxy(QNetworkProxy::NoProxy);
QSslSocket::setDefaultCiphers(safeCipherList());
QSslConfiguration sslConf {QSslConfiguration::defaultConfiguration()};
sslConf.setCiphers(safeCipherList());
QSslConfiguration::setDefaultConfiguration(sslConf);
auto *dropConnectionTimer = new QTimer(this); auto *dropConnectionTimer = new QTimer(this);
connect(dropConnectionTimer, &QTimer::timeout, this, &Server::dropTimedOutConnection); connect(dropConnectionTimer, &QTimer::timeout, this, &Server::dropTimedOutConnection);