warnings if download to memory failed for some reason

This commit is contained in:
Michael Nilsson
2016-05-05 10:53:50 -04:00
parent 12baec3827
commit df030b4529
5 changed files with 42 additions and 22 deletions
+11 -10
View File
@@ -227,26 +227,27 @@ std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadToMemory(
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferinfo);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, &p);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L);
CURLcode res = curl_easy_perform(curl);
if(res == CURLE_OK){
// ask for the content-type
char *ct;
res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if(ct){
if (res == CURLE_OK){
future->format = std::string(ct);
}
}
curl_easy_cleanup(curl);
if (res == CURLE_OK)
future->isFinished = true;
else
future->isFinished = true;
}
} else{
future->errorMessage = curl_easy_strerror(res);
future->isAborted = true;
}
if (finishedCallback)
finishedCallback(*future);
curl_easy_cleanup(curl);
}
};