mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 04:00:37 -06:00
fetchFile in downloadmanager will fail when response status is 400 or above
This commit is contained in:
@@ -118,7 +118,7 @@ bool DataSphere::loadTexture(){
|
||||
if(_futureObject.valid() && DownloadManager::futureReady(_futureObject)){
|
||||
DownloadManager::MemoryFile dataFile = _futureObject.get();
|
||||
|
||||
if(dataFile.corrupted)
|
||||
if(dataFile.corrupted)
|
||||
return false;
|
||||
|
||||
_dataBuffer = "";
|
||||
|
||||
@@ -444,18 +444,18 @@ void IswaManager::fillCygnetInfo(std::string jsonString){
|
||||
for(auto list : lists){
|
||||
json jsonList = j[list];
|
||||
for(int i=0; i<jsonList.size(); i++){
|
||||
json jCygnet = jsonList.at(i);
|
||||
json jCygnet = jsonList.at(i);
|
||||
|
||||
std::string name = jCygnet["cygnetDisplayTitle"];
|
||||
std::replace(name.begin(), name.end(),'.', ',');
|
||||
std::string name = jCygnet["cygnetDisplayTitle"];
|
||||
std::replace(name.begin(), name.end(),'.', ',');
|
||||
|
||||
CygnetInfo info = {
|
||||
name,
|
||||
jCygnet["cygnetDescription"],
|
||||
jCygnet["cygnetUpdateInterval"],
|
||||
false
|
||||
};
|
||||
_cygnetInformation[jCygnet["cygnetID"]] = std::make_shared<CygnetInfo>(info);
|
||||
CygnetInfo info = {
|
||||
name,
|
||||
jCygnet["cygnetDescription"],
|
||||
jCygnet["cygnetUpdateInterval"],
|
||||
false
|
||||
};
|
||||
_cygnetInformation[jCygnet["cygnetID"]] = std::make_shared<CygnetInfo>(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,6 +300,8 @@ std::future<DownloadManager::MemoryFile> DownloadManager::fetchFile(
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&file);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeMemoryCallback);
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L);
|
||||
// Will fail when response status is 400 or above
|
||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
|
||||
|
||||
CURLcode res = curl_easy_perform(curl);
|
||||
if(res == CURLE_OK){
|
||||
|
||||
Reference in New Issue
Block a user