diff options
| author | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
| commit | cd2dad3bc7ae0ee0a18b7b20a945009362ec3851 (patch) | |
| tree | 5a622ec4193e9bc899f6499f936848a661be29cb /Network/NetworkAccessManager.cpp | |
| parent | 558c0b9d6ecf70c5222e2069ece1fea3656c75d7 (diff) | |
| parent | 291b3817bf0c7a742e9e17d42c94fc8c9530e40d (diff) | |
Merge branch 'debian/latest' into debian/trixie-backports
Diffstat (limited to 'Network/NetworkAccessManager.cpp')
| -rw-r--r--[-rwxr-xr-x] | Network/NetworkAccessManager.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/Network/NetworkAccessManager.cpp b/Network/NetworkAccessManager.cpp index b5592c07..e0b06be7 100755..100644 --- a/Network/NetworkAccessManager.cpp +++ b/Network/NetworkAccessManager.cpp @@ -1,62 +1,62 @@ -#include "Network/NetworkAccessManager.hpp"
-
-#include <QString>
-#include <QNetworkReply>
-
-#include "moc_NetworkAccessManager.cpp"
-
-NetworkAccessManager::NetworkAccessManager (QWidget * parent)
- : QNetworkAccessManager (parent)
- , parent_widget_ {parent}
-{
- // handle SSL errors that have not been cached as allowed
- // exceptions and offer them to the user to add to the ignored
- // exception cache
- connect (this, &QNetworkAccessManager::sslErrors, this, &NetworkAccessManager::filter_SSL_errors);
-}
-
-void NetworkAccessManager::filter_SSL_errors (QNetworkReply * reply, QList<QSslError> const& errors)
-{
- QString message;
- QList<QSslError> new_errors;
- for (auto const& error: errors)
- {
- if (!allowed_ssl_errors_.contains (error))
- {
- new_errors << error;
- message += '\n' + reply->request ().url ().toDisplayString () + ": " + error.errorString ();
- }
- }
- if (new_errors.size ())
- {
- QString certs;
- for (auto const& cert : reply->sslConfiguration ().peerCertificateChain ())
- {
- certs += cert.toText () + '\n';
- }
- if (MessageBox::Ignore == MessageBox::query_message (parent_widget_
- , tr ("Network SSL/TLS Errors")
- , message, certs
- , MessageBox::Abort | MessageBox::Ignore))
- {
- // accumulate new SSL error exceptions that have been allowed
- allowed_ssl_errors_.append (new_errors);
- reply->ignoreSslErrors (allowed_ssl_errors_);
- }
- }
- else
- {
- // no new exceptions so silently ignore the ones already allowed
- reply->ignoreSslErrors (allowed_ssl_errors_);
- }
-}
-
-QNetworkReply * NetworkAccessManager::createRequest (Operation operation, QNetworkRequest const& request
- , QIODevice * outgoing_data)
-{
- auto reply = QNetworkAccessManager::createRequest (operation, request, outgoing_data);
- // errors are usually certificate specific so passing all cached
- // exceptions here is ok
- reply->ignoreSslErrors (allowed_ssl_errors_);
- return reply;
-}
+#include "Network/NetworkAccessManager.hpp" + +#include <QString> +#include <QNetworkReply> + +#include "moc_NetworkAccessManager.cpp" + +NetworkAccessManager::NetworkAccessManager (QWidget * parent) + : QNetworkAccessManager (parent) + , parent_widget_ {parent} +{ + // handle SSL errors that have not been cached as allowed + // exceptions and offer them to the user to add to the ignored + // exception cache + connect (this, &QNetworkAccessManager::sslErrors, this, &NetworkAccessManager::filter_SSL_errors); +} + +void NetworkAccessManager::filter_SSL_errors (QNetworkReply * reply, QList<QSslError> const& errors) +{ + QString message; + QList<QSslError> new_errors; + for (auto const& error: errors) + { + if (!allowed_ssl_errors_.contains (error)) + { + new_errors << error; + message += '\n' + reply->request ().url ().toDisplayString () + ": " + error.errorString (); + } + } + if (new_errors.size ()) + { + QString certs; + for (auto const& cert : reply->sslConfiguration ().peerCertificateChain ()) + { + certs += cert.toText () + '\n'; + } + if (MessageBox::Ignore == MessageBox::query_message (parent_widget_ + , tr ("Network SSL/TLS Errors") + , message, certs + , MessageBox::Abort | MessageBox::Ignore)) + { + // accumulate new SSL error exceptions that have been allowed + allowed_ssl_errors_.append (new_errors); + reply->ignoreSslErrors (allowed_ssl_errors_); + } + } + else + { + // no new exceptions so silently ignore the ones already allowed + reply->ignoreSslErrors (allowed_ssl_errors_); + } +} + +QNetworkReply * NetworkAccessManager::createRequest (Operation operation, QNetworkRequest const& request + , QIODevice * outgoing_data) +{ + auto reply = QNetworkAccessManager::createRequest (operation, request, outgoing_data); + // errors are usually certificate specific so passing all cached + // exceptions here is ok + reply->ignoreSslErrors (allowed_ssl_errors_); + return reply; +} |
