the Dolby certificate server (#1541).
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
}
optional<string>
-get_from_url (string url, bool pasv, ScopedTemporary& temp)
+get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
{
CURL* curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
curl_easy_setopt (curl, CURLOPT_FTP_USE_EPRT, 0);
+ if (skip_pasv_ip) {
+ curl_easy_setopt (curl, CURLOPT_FTP_SKIP_PASV_IP, 1);
+ }
if (!pasv) {
curl_easy_setopt (curl, CURLOPT_FTPPORT, "-");
}
}
optional<string>
-get_from_url (string url, bool pasv, function<void (boost::filesystem::path)> load)
+get_from_url (string url, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load)
{
ScopedTemporary temp;
- optional<string> e = get_from_url (url, pasv, temp);
+ optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp);
if (e) {
return e;
}
* @param load Function passed a (temporary) filesystem path of the unpacked file.
*/
optional<string>
-get_from_zip_url (string url, string file, bool pasv, function<void (boost::filesystem::path)> load)
+get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load)
{
/* Download the ZIP file to temp_zip */
ScopedTemporary temp_zip;
- optional<string> e = get_from_url (url, pasv, temp_zip);
+ optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
if (e) {
return e;
}
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
class ScopedTemporary;
-boost::optional<std::string> get_from_url (std::string url, bool pasv, ScopedTemporary& temp);
-boost::optional<std::string> get_from_url (std::string url, bool pasv, boost::function<void (boost::filesystem::path)> load);
-boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, boost::function<void (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
serial
);
- optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
if (error) {
_dialog->message()->SetLabel(wxT(""));
error_dialog (this, std_to_wx(*error));
optional<string> all_errors;
- optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
if (error) {
all_errors = *error;
string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
- error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
if (error) {
*all_errors += "\n" + *error;
}
list<string>::const_iterator i = urls.begin ();
list<string>::const_iterator j = files.begin ();
while (!ok && i != urls.end ()) {
- optional<string> error = get_from_zip_url (*i++, *j++, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_zip_url (*i++, *j++, true, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
if (error) {
errors.push_back (error.get ());
} else {
wx_to_std(_serial->GetValue())
);
- optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+ optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
if (error) {
_dialog->message()->SetLabel(wxT(""));
string url = Config::instance()->kdm_server_url();
boost::algorithm::replace_all (url, "{CPL}", *dcp->cpl());
optional<dcp::EncryptedKDM> kdm;
- if (dcp->cpl() && !get_from_url(url, false, temp)) {
+ if (dcp->cpl() && !get_from_url(url, false, false, temp)) {
try {
kdm = dcp::EncryptedKDM (dcp::file_to_string(temp.file()));
if (kdm->cpl_id() != dcp->cpl()) {