Browse Source

Replace deprecated QSslSocket::setDefaultCiphers()

adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
c657134344
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 8
      src/base/http/server.cpp

8
src/base/http/server.cpp

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

Loading…
Cancel
Save