From ce31ba091cffe047a789cb7c62703fd2b04f3cbe Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Mon, 11 Nov 2024 06:16:45 +1000 Subject: [PATCH] Using proxy for zarr data and metadata --- include/zarr.h | 3 +++ src/zarr.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/include/zarr.h b/include/zarr.h index 5794add..5c316a7 100644 --- a/include/zarr.h +++ b/include/zarr.h @@ -94,6 +94,7 @@ class ZarrFunctions: public ZarrTypes std::unique_ptr cache; CURLRAII chandle; MString url; + MString proxyurl; std::vector> chunks; @@ -107,6 +108,8 @@ class ZarrFunctions: public ZarrTypes { auto oldprefix = michlib::GPL.UsePrefix("ZARR"); cache.reset(CreateCache(michlib::GPL.ParameterSValue("Cache", ""))); + proxyurl = michlib::GPL.ParameterSValue("Proxy", ""); + if(proxyurl.Exist()) curl_easy_setopt(chandle, CURLOPT_PROXY, proxyurl.Buf()); michlib::GPL.UsePrefix(oldprefix); if(!cache) { diff --git a/src/zarr.cpp b/src/zarr.cpp index 3eafa63..006a707 100644 --- a/src/zarr.cpp +++ b/src/zarr.cpp @@ -171,6 +171,7 @@ Error ZarrFunctions::GetChunk(const MString& var, const std::vector& chu { michlib::message(str + " not found in cache, downloading"); CURLRAII myhandle; // TODO: remove this workaround of unknown bug + if(proxyurl.Exist()) curl_easy_setopt(myhandle, CURLOPT_PROXY, proxyurl.Buf()); //auto [out, res] = GetUrl(chandle, str); auto [out, res] = GetUrl(myhandle, str); if(res != CURLE_OK) return Error(pref, MString("can't download chunk: ") + chandle.Err());