aboutsummaryrefslogtreecommitdiff
path: root/lib/networkaccessmanager.cpp
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-02-22 13:51:51 +0100
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commitc2836e007e2d46c0c20270b99ede5b78d2c7170b (patch)
treee235f5c3e18b0f396592fd6dd787362d9f208ffd /lib/networkaccessmanager.cpp
parentea617d31cf3f72f76fd49c0a20f445a78678fe5f (diff)
downloadlibquotient-c2836e007e2d46c0c20270b99ede5b78d2c7170b.tar.gz
libquotient-c2836e007e2d46c0c20270b99ede5b78d2c7170b.zip
ssl
Diffstat (limited to 'lib/networkaccessmanager.cpp')
-rw-r--r--lib/networkaccessmanager.cpp17
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;