From 9b5e0f393d9aeb022d38b6ccfe7f12e77aa05e5f Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 28 Jun 2022 09:53:56 -0700 Subject: [PATCH] crashhandler: handle ssl errors --- app/crashhandler/crashhandler.cpp | 17 +++++++++++++++++ app/crashhandler/crashhandler.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/app/crashhandler/crashhandler.cpp b/app/crashhandler/crashhandler.cpp index a8d9368bb..b686d6f58 100644 --- a/app/crashhandler/crashhandler.cpp +++ b/app/crashhandler/crashhandler.cpp @@ -161,6 +161,22 @@ void CrashHandlerDialog::ReplyFinished(QNetworkReply* reply) } } +void CrashHandlerDialog::HandleSslErrors(QNetworkReply *reply, const QList &errors) +{ + QStringList errors; + for (const QSslError &err : errors) { + errors.append(err.errorString()); + } + + QMessageBox b(this); + b.setIcon(QMessageBox::Critical); + b.setWindowModality(Qt::WindowModal); + b.setWindowTitle(tr("SSL Error")); + b.setText(tr("Encountered the following SSL errors:\n\n%1").arg(errors.join('\n'))); + b.addButton(QMessageBox::Ok); + b.exec(); +} + void CrashHandlerDialog::AttemptToFindReport() { // If we found it, use it, otherwise wait a second and try again @@ -198,6 +214,7 @@ void CrashHandlerDialog::SendErrorReport() QNetworkAccessManager* manager = new QNetworkAccessManager(); connect(manager, &QNetworkAccessManager::finished, this, &CrashHandlerDialog::ReplyFinished); + connect(manager, &QNetworkAccessManager::sslErrors, this, &CrashHandlerDialog::HandleSslErrors); QNetworkRequest request; request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); diff --git a/app/crashhandler/crashhandler.h b/app/crashhandler/crashhandler.h index d4e37d583..d377061e2 100644 --- a/app/crashhandler/crashhandler.h +++ b/app/crashhandler/crashhandler.h @@ -65,6 +65,8 @@ protected: private slots: void ReplyFinished(QNetworkReply *reply); + void HandleSslErrors(QNetworkReply *reply, const QList &errors); + void AttemptToFindReport(); void ReadProcessHasData();