Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Adam <dev@robert-adam.de>2021-04-13 11:34:47 +0300
committerRobert Adam <dev@robert-adam.de>2021-04-13 11:42:55 +0300
commite1ee1fe52e5fcb45f9f399a1e8294a953ffd011d (patch)
treef777524903202a2417ed667397507ba852e0def7
parentda5b6edd07ae73fb1522bb2b9c08d6340b02f0c4 (diff)
FIX(client): CrashReporter considering 2xx codes as errors
Apparently nobody has told Qt that 2xx HTTP status codes are considered success. Therefore checking QNetworkReply::error() in order to check whether the transfer was successful, does not work. Instead this commit makes sure that the raw HTTP status code is checked instead and if it is in range [200,299], the sending of the report is considered a success. Furthermore this commit reworks the Strings displayed to the user (message box) as these were excessively long. These formulations have been replaced with (hopefully) more concise versions. Fixes #4928
-rw-r--r--src/mumble/CrashReporter.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mumble/CrashReporter.cpp b/src/mumble/CrashReporter.cpp
index 5ab600c49..b1511a884 100644
--- a/src/mumble/CrashReporter.cpp
+++ b/src/mumble/CrashReporter.cpp
@@ -72,22 +72,32 @@ CrashReporter::~CrashReporter() {
void CrashReporter::uploadFinished() {
qpdProgress->reset();
- if (qnrReply->error() == QNetworkReply::NoError) {
- if (qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200)
+
+ QVariant varStatus = qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
+ if (!varStatus.isValid()) {
+ qWarning() << "CrashReporter.cpp: Invalid HTTP code attribute";
+ }
+
+ int httpStatusCode = varStatus.toInt();
+
+ if (httpStatusCode != 0) {
+ // The 2xx HTTP status codes are considered success
+ if (httpStatusCode >= 200 && httpStatusCode < 300) {
QMessageBox::information(nullptr, tr("Crash upload successful"),
tr("Thank you for helping make Mumble better!"));
- else
+ } else {
QMessageBox::critical(nullptr, tr("Crash upload failed"),
- tr("We're really sorry, but it appears the crash upload has failed with error %1 %2. "
- "Please inform a developer.")
- .arg(qnrReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt())
+ tr("HTTP error %1: \"%2\"")
+ .arg(httpStatusCode)
.arg(qnrReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()));
+ }
} else {
QMessageBox::critical(nullptr, tr("Crash upload failed"),
- tr("This really isn't funny, but apparently there's a bug in the crash reporting code, "
- "and we've failed to upload the report. You may inform a developer about error %1")
+ tr("Internal error encountered in CrashReporter.cpp: Received network reply does not contain an HTTP status code."
+ " Please inform a developer about error code %1")
.arg(qnrReply->error()));
}
+
qelLoop->exit(0);
}