- return String::compose (_("Download failed (%1/%2 error %3)"), url, file, (int) cr);
+ return String::compose (_("Download failed (%1 error %2)"), url, (int) cr);
+ }
+
+ return optional<string>();
+}
+
+
+optional<string>
+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;
+ }
+ 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<optional<string> (boost::filesystem::path)> load)
+{
+ /* Download the ZIP file to temp_zip */
+ ScopedTemporary temp_zip;
+ optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
+ if (e) {
+ return e;