|
|
@ -36,6 +36,7 @@ RetVal<std::vector<struct FileInfo>> COPERNICUSData::ReadRemoteFileList(const MS |
|
|
|
MString cont; |
|
|
|
MString cont; |
|
|
|
bool next = true; |
|
|
|
bool next = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLRAII chandle; |
|
|
|
while(next) |
|
|
|
while(next) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MString url = bucket + "?list-type=2&prefix=" + prefix; |
|
|
|
MString url = bucket + "?list-type=2&prefix=" + prefix; |
|
|
@ -43,7 +44,7 @@ RetVal<std::vector<struct FileInfo>> COPERNICUSData::ReadRemoteFileList(const MS |
|
|
|
cont = ""; |
|
|
|
cont = ""; |
|
|
|
|
|
|
|
|
|
|
|
auto [data, res] = GetUrl(chandle, url); |
|
|
|
auto [data, res] = GetUrl(chandle, url); |
|
|
|
if(res != CURLE_OK) return {pref, MString("Can't download ") + url + ": " + curlerr}; |
|
|
|
if(res != CURLE_OK) return {pref, MString("Can't download ") + url + ": " + chandle.Err()}; |
|
|
|
|
|
|
|
|
|
|
|
xmlDocPtr doc = xmlReadMemory(data.Buf(), data.Len(), "data.xml", nullptr, 0); |
|
|
|
xmlDocPtr doc = xmlReadMemory(data.Buf(), data.Len(), "data.xml", nullptr, 0); |
|
|
|
if(doc == nullptr) return {pref, MString("Can't download ") + url + ": XML parse error"}; |
|
|
|
if(doc == nullptr) return {pref, MString("Can't download ") + url + ": XML parse error"}; |
|
|
@ -128,7 +129,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const |
|
|
|
dsets = dlist.Value(); |
|
|
|
dsets = dlist.Value(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CURLRAII dhandle; |
|
|
|
CURLRAII chandle; |
|
|
|
for(const auto& dset: dsets) |
|
|
|
for(const auto& dset: dsets) |
|
|
|
{ |
|
|
|
{ |
|
|
|
michlib::message("Mirroring " + dset); |
|
|
|
michlib::message("Mirroring " + dset); |
|
|
@ -180,7 +181,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const |
|
|
|
for(size_t i = 0; i < down.size(); i++) |
|
|
|
for(size_t i = 0; i < down.size(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t ri = down[i]; |
|
|
|
size_t ri = down[i]; |
|
|
|
auto err = DownloadFile(dhandle, rfiles[ri], locroot); |
|
|
|
auto err = DownloadFile(chandle, rfiles[ri], locroot); |
|
|
|
if(!err) return err.Add(pref, "Can't download file"); |
|
|
|
if(!err) return err.Add(pref, "Can't download file"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -195,7 +196,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
size_t ri = upd[i].first; |
|
|
|
size_t ri = upd[i].first; |
|
|
|
size_t li = upd[i].second; |
|
|
|
size_t li = upd[i].second; |
|
|
|
auto err = UpdateFile(dhandle, rfiles[ri], lfiles[li], locroot); |
|
|
|
auto err = UpdateFile(chandle, rfiles[ri], lfiles[li], locroot); |
|
|
|
if(!err) return err.Add(pref, "Can't update file"); |
|
|
|
if(!err) return err.Add(pref, "Can't update file"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|