mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-07-15 15:24:25 -04:00
Build a cache of allowed SSL exceptions and use them on future network requests
The class NetworkAccessManager sub-classes QNetworkAccessManager adding a message box to ask the user if SSL errors may be ignored. Ignored errors are ignored in future server replies so that the user is not asked about he same peer certificate chain repeatedly. The cache is currently per process only and not persistent. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7361 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QApplication>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QRegularExpression>
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
@@ -316,25 +314,8 @@ int main(int argc, char *argv[])
|
||||
).toBool () ? 1u : 4u;
|
||||
}
|
||||
|
||||
QNetworkAccessManager network_manager {&a};
|
||||
|
||||
// run the application UI
|
||||
MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &network_manager, &splash);
|
||||
|
||||
// set up handling for any SSL issues
|
||||
QObject::connect (&network_manager, &QNetworkAccessManager::sslErrors, [&w] (QNetworkReply * reply, QList<QSslError> const& errors) {
|
||||
QString message;
|
||||
for (auto const& error: errors)
|
||||
{
|
||||
message += '\n' + reply->request ().url ().toDisplayString () + ": "
|
||||
+ error.errorString ();
|
||||
}
|
||||
if (QMessageBox::Ignore == QMessageBox::question (&w, "Network SSL Errors", message, QMessageBox::Abort | QMessageBox::Ignore))
|
||||
{
|
||||
reply->ignoreSslErrors ();
|
||||
}
|
||||
});
|
||||
|
||||
MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &splash);
|
||||
w.show();
|
||||
splash.raise ();
|
||||
QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));
|
||||
|
||||
Reference in New Issue
Block a user