summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-27 18:43:30 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-27 18:43:30 +0000
commit123ca24b4d3921f0ba1a7ee7df4dc5bc02a99d17 (patch)
tree85158cb17663225c7b21e17e2865b4efac1f8e52
parent18c3b488dff343a9b287d8d0fd68143b792ec75e (diff)
Some Doremi certs are on the FTP site as *.dcicerts.zip, some as *.certs.zip; also add better error reporting when downloads fail (#763).
-rw-r--r--ChangeLog4
-rw-r--r--src/wx/doremi_certificate_panel.cc27
2 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b7526b8a4..a3aa8810c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-27 Carl Hetherington <cth@carlh.net>
+
+ * Fix download of some Doremi certificates (#763).
+
2015-11-27 c.hetherington <cth@carlh.net>
* Updated de_DE translation from Carsten Kurz.
diff --git a/src/wx/doremi_certificate_panel.cc b/src/wx/doremi_certificate_panel.cc
index 8b54d1c37..aaebb7390 100644
--- a/src/wx/doremi_certificate_panel.cc
+++ b/src/wx/doremi_certificate_panel.cc
@@ -26,10 +26,12 @@
#include "lib/internet.h"
#include <curl/curl.h>
#include <zip.h>
+#include <boost/foreach.hpp>
#include <iostream>
using std::string;
using std::cout;
+using std::list;
using boost::function;
using boost::optional;
@@ -67,6 +69,8 @@ DoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
{
/* Try dcp2000, imb and ims prefixes (see mantis #375) */
+ list<string> errors;
+
optional<string> error = get_from_zip_url (
String::compose (
"ftp://service:t3chn1c1an@ftp.doremilabs.com/Certificates/%1xxx/dcp2000-%2.dcicerts.zip",
@@ -77,6 +81,19 @@ DoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
);
if (error) {
+ errors.push_back (error.get ());
+ error = get_from_zip_url (
+ String::compose (
+ "ftp://service:t3chn1c1an@ftp.doremilabs.com/Certificates/%1xxx/dcp2000-%2.certs.zip",
+ serial.substr(0, 3), serial
+ ),
+ String::compose ("dcp2000-%1.cert.sha256.pem", serial),
+ boost::bind (&DownloadCertificatePanel::load, this, _1)
+ );
+ }
+
+ if (error) {
+ errors.push_back (error.get ());
error = get_from_zip_url (
String::compose (
"ftp://service:t3chn1c1an@ftp.doremilabs.com/Certificates/%1xxx/imb-%2.dcicerts.zip",
@@ -88,6 +105,7 @@ DoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
}
if (error) {
+ errors.push_back (error.get ());
error = get_from_zip_url (
String::compose (
"ftp://service:t3chn1c1an@ftp.doremilabs.com/Certificates/%1xxx/ims-%2.dcicerts.zip",
@@ -99,8 +117,15 @@ DoremiCertificatePanel::finish_download (string serial, wxStaticText* message)
}
if (error) {
+ errors.push_back (error.get ());
message->SetLabel (wxT (""));
- error_dialog (this, std_to_wx (error.get ()));
+
+ SafeStringStream s;
+ BOOST_FOREACH (string e, errors) {
+ s << e << "\n";
+ }
+
+ error_dialog (this, std_to_wx (s.str ()));
} else {
message->SetLabel (_("Certificate downloaded"));
_dialog->setup_sensitivity ();