Note that newer libsub version is required.
[dcpomatic.git] / src / wx / gdc_certificate_panel.cc
index ffd7de52f444626d58cc2e6568e7aba6d8220da2..89aa3f44a4bded2d3455ecb33e721900b497a0ca 100644 (file)
 
 */
 
-#include "gdc_certificate_panel.h"
+
 #include "download_certificate_dialog.h"
+#include "gdc_certificate_panel.h"
 #include "wx_util.h"
-#include "lib/internet.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
+#include "lib/internet.h"
+#include <boost/algorithm/string.hpp>
+
 
 using std::string;
-using boost::optional;
+using namespace boost::algorithm;
 using boost::bind;
+using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
+
 
 GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog)
        : CredentialsDownloadCertificatePanel (
@@ -46,14 +54,17 @@ GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog)
 void
 GDCCertificatePanel::do_download ()
 {
-       string const url = String::compose(
-               "ftp://%1:%2@ftp.gdc-tech.com/SHA256/A%3.crt.pem",
+       string serial = wx_to_std (_serial->GetValue());
+       trim(serial);
+       string url = String::compose(
+               "ftp://%1:%2@ftp.gdc-tech.com/SHA256/%3.crt.pem",
                Config::instance()->gdc_username().get(),
                Config::instance()->gdc_password().get(),
-               wx_to_std(_serial->GetValue())
+               serial
                );
+       trim(url);
 
-       optional<string> error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1));
+       auto error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1, _2));
 
        if (error) {
                _dialog->message()->SetLabel(wxT(""));