}
}
+ if (model_.empty()){
+ return 1;
+ }
+
return 0;
}
data.file_size = set_resume_point(output_file_partial);
set_progress_options(progress, data);
set_headers(headers);
- perform(url);
+ CURLcode res = perform(url);
+ if (res != CURLE_OK){
+ printe("Fetching resource '%s' failed: %s\n", url.c_str(), curl_easy_strerror(res));
+ return 1;
+ }
if (!output_file.empty()) {
std::filesystem::rename(output_file_partial, output_file);
}
}
}
- void perform(const std::string & url) {
- CURLcode res;
+ CURLcode perform(const std::string & url) {
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
- res = curl_easy_perform(curl);
- if (res != CURLE_OK) {
- printe("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
- }
+ return curl_easy_perform(curl);
}
static std::string human_readable_time(double seconds) {