Some Doremi certs are on the FTP site as *.dcicerts.zip, some as *.certs.zip; also...
authorCarl Hetherington <cth@carlh.net>
Fri, 27 Nov 2015 18:43:30 +0000 (18:43 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 27 Nov 2015 18:43:30 +0000 (18:43 +0000)
ChangeLog
src/wx/doremi_certificate_panel.cc

index b7526b8a4eb732a215d2947814edd01c212688f5..a3aa8810c5899fe040e1cc39d0e4b58c03aa28f2 100644 (file)
--- 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.
index 8b54d1c37e7b36d11e1eae1ad281c518149ec116..aaebb7390831ee709bc7f85efeffe74eaeac9aca 100644 (file)
 #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 ();