@@ -203,6 +203,10 @@ class CurlFetcher : public IFetcher
203203 void init (const std::string& path, const FetchAuth& auth) override
204204 {
205205 auth_ = auth;
206+ if (auth_.max_retry_ > 0 )
207+ maxRetries_ = auth_.max_retry_ ;
208+ if (auth_.retry_delay_ > 0 )
209+ retryDelayMs_ = auth_.retry_delay_ * 1000 ;
206210 parse (path);
207211 fetch_total_size ();
208212 }
@@ -598,6 +602,14 @@ class CurlFetcher : public IFetcher
598602 if (EnvVarManager::get (" GRK_CURL_PROXYAUTH" ))
599603 curl_easy_setopt (curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
600604 }
605+
606+ // User agent
607+ if (!auth_.user_agent_ .empty ())
608+ curl_easy_setopt (curl, CURLOPT_USERAGENT, auth_.user_agent_ .c_str ());
609+
610+ // Timeouts
611+ long connect_timeout = auth_.connect_timeout_ > 0 ? auth_.connect_timeout_ : 10L ;
612+ curl_easy_setopt (curl, CURLOPT_CONNECTTIMEOUT, connect_timeout);
601613 }
602614
603615 curl_slist* configureHeaders (const std::string& range)
@@ -685,7 +697,6 @@ class CurlFetcher : public IFetcher
685697 throw std::runtime_error (" Failed to initialize CURL easy handle" );
686698
687699 curl_easy_setopt (curl, CURLOPT_URL, url_.c_str ());
688- curl_easy_setopt (curl, CURLOPT_CONNECTTIMEOUT, 10L );
689700 curl_initiate_retry (curl);
690701 curl_easy_setopt (curl, CURLOPT_VERBOSE, 0L );
691702 curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, callback);
@@ -860,7 +871,8 @@ class CurlFetcher : public IFetcher
860871
861872 void curl_initiate_retry (CURL* curl)
862873 {
863- curl_easy_setopt (curl, CURLOPT_TIMEOUT, 30L );
874+ long timeout = auth_.timeout_ > 0 ? auth_.timeout_ : 30L ;
875+ curl_easy_setopt (curl, CURLOPT_TIMEOUT, timeout);
864876 }
865877
866878 /* *
0 commit comments