diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-05-14 20:14:52 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-05-14 20:14:52 +0200 |
| commit | 8c7ad603cf0a534abe1a920b70b0daa095257d3a (patch) | |
| tree | 28ecc906611cd60b6d2df3d33446e32eb654d907 /src/lib/internet.cc | |
| parent | 4edc14c8b1410e24f68b510cc14409b96c0338a3 (diff) | |
Don't say 'certificate downloaded' if it failed during the read part.
Diffstat (limited to 'src/lib/internet.cc')
| -rw-r--r-- | src/lib/internet.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/internet.cc b/src/lib/internet.cc index b993117bb..943363d1a 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -119,24 +119,25 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp) return optional<string>(); } + optional<string> -get_from_url (string url, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load) +get_from_url (string url, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load) { ScopedTemporary temp; optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp); if (e) { return e; } - load (temp.file()); - return optional<string>(); + return load (temp.file()); } + /** @param url URL of ZIP file. * @param file Filename within ZIP file. * @param load Function passed a (temporary) filesystem path of the unpacked file. */ optional<string> -get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load) +get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<optional<string> (boost::filesystem::path)> load) { /* Download the ZIP file to temp_zip */ ScopedTemporary temp_zip; @@ -193,6 +194,5 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio zip_close (zip); temp_cert.close (); - load (temp_cert.file ()); - return optional<string> (); + return load (temp_cert.file()); } |
