|
|
|
@ -36,6 +36,7 @@ RetVal<std::vector<struct FileInfo>> COPERNICUSData::ReadRemoteFileList(const MS
|
|
|
|
|
MString cont; |
|
|
|
|
bool next = true; |
|
|
|
|
|
|
|
|
|
CURLRAII chandle; |
|
|
|
|
while(next) |
|
|
|
|
{ |
|
|
|
|
MString url = bucket + "?list-type=2&prefix=" + prefix; |
|
|
|
@ -43,7 +44,7 @@ RetVal<std::vector<struct FileInfo>> COPERNICUSData::ReadRemoteFileList(const MS
|
|
|
|
|
cont = ""; |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
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(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CURLRAII dhandle; |
|
|
|
|
CURLRAII chandle; |
|
|
|
|
for(const auto& dset: dsets) |
|
|
|
|
{ |
|
|
|
|
michlib::message("Mirroring " + dset); |
|
|
|
@ -180,7 +181,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const
|
|
|
|
|
for(size_t i = 0; i < down.size(); 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"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -195,7 +196,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const
|
|
|
|
|
{ |
|
|
|
|
size_t ri = upd[i].first; |
|
|
|
|
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"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|