diff options
author | Carl Schwan <carl@carlschwan.eu> | 2021-02-22 13:51:51 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:34:52 +0100 |
commit | c2836e007e2d46c0c20270b99ede5b78d2c7170b (patch) | |
tree | e235f5c3e18b0f396592fd6dd787362d9f208ffd /lib/networkaccessmanager.cpp | |
parent | ea617d31cf3f72f76fd49c0a20f445a78678fe5f (diff) | |
download | libquotient-c2836e007e2d46c0c20270b99ede5b78d2c7170b.tar.gz libquotient-c2836e007e2d46c0c20270b99ede5b78d2c7170b.zip |
ssl
Diffstat (limited to 'lib/networkaccessmanager.cpp')
-rw-r--r-- | lib/networkaccessmanager.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/networkaccessmanager.cpp b/lib/networkaccessmanager.cpp index 293538ee..d0380cec 100644 --- a/lib/networkaccessmanager.cpp +++ b/lib/networkaccessmanager.cpp @@ -40,17 +40,24 @@ public: NetworkAccessManager::NetworkAccessManager(QObject* parent) : QNetworkAccessManager(parent), d(std::make_unique<Private>(this)) -{ - connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList<QSslError> &errors) { - reply->ignoreSslErrors(); - }); -} +{} QList<QSslError> NetworkAccessManager::ignoredSslErrors() const { return d->ignoredSslErrors; } +void NetworkAccessManager::ignoreSslErrors(bool ignore) const +{ + if (ignore) { + connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList<QSslError> &errors) { + reply->ignoreSslErrors(); + }); + } else { + disconnect(this, &QNetworkAccessManager::sslErrors, this, nullptr); + } +} + void NetworkAccessManager::addIgnoredSslError(const QSslError& error) { d->ignoredSslErrors << error; |