aboutsummaryrefslogtreecommitdiff
path: root/lib/networkaccessmanager.cpp
diff options
context:
space:
mode:
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;