fetchFile in downloadmanager will fail when response status is 400 or above

This commit is contained in:
Michael Nilsson
2016-05-17 17:21:46 -04:00
parent 20f43a8110
commit 2af533e6fe
3 changed files with 13 additions and 11 deletions

View File

@@ -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 = "";

View File

@@ -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);
}
}
}

View File

@@ -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){