@@ -217,13 +217,11 @@ struct curl_slist_ptr {
217
217
#define CURL_MAX_RETRY 3
218
218
#define CURL_RETRY_DELAY_SECONDS 2
219
219
220
- static bool curl_perform_with_retry (const std::string & url, CURL * curl, int max_attempts, int retry_delay_seconds) {
220
+ static bool curl_perform_with_retry (const std::string & url, CURL * curl, int max_attempts, int retry_delay_seconds, const char * method_name ) {
221
221
int remaining_attempts = max_attempts;
222
- char * method = nullptr ;
223
- curl_easy_getinfo (curl, CURLINFO_EFFECTIVE_METHOD, &method);
224
222
225
223
while (remaining_attempts > 0 ) {
226
- LOG_INF (" %s: %s %s (attempt %d of %d)...\n " , __func__ , method , url.c_str (), max_attempts - remaining_attempts + 1 , max_attempts);
224
+ LOG_INF (" %s: %s %s (attempt %d of %d)...\n " , __func__ , method_name , url.c_str (), max_attempts - remaining_attempts + 1 , max_attempts);
227
225
228
226
CURLcode res = curl_easy_perform (curl);
229
227
if (res == CURLE_OK) {
@@ -343,7 +341,7 @@ static bool common_download_file_single(const std::string & url, const std::stri
343
341
344
342
// we only allow retrying once for HEAD requests
345
343
// this is for the use case of using running offline (no internet), retrying can be annoying
346
- bool was_perform_successful = curl_perform_with_retry (url, curl.get (), 1 , 0 );
344
+ bool was_perform_successful = curl_perform_with_retry (url, curl.get (), 1 , 0 , " HEAD " );
347
345
if (!was_perform_successful) {
348
346
head_request_ok = false ;
349
347
}
@@ -425,7 +423,7 @@ static bool common_download_file_single(const std::string & url, const std::stri
425
423
// start the download
426
424
LOG_INF (" %s: trying to download model from %s to %s (server_etag:%s, server_last_modified:%s)...\n " , __func__,
427
425
llama_download_hide_password_in_url (url).c_str (), path.c_str (), headers.etag .c_str (), headers.last_modified .c_str ());
428
- bool was_perform_successful = curl_perform_with_retry (url, curl.get (), CURL_MAX_RETRY, CURL_RETRY_DELAY_SECONDS);
426
+ bool was_perform_successful = curl_perform_with_retry (url, curl.get (), CURL_MAX_RETRY, CURL_RETRY_DELAY_SECONDS, " GET " );
429
427
if (!was_perform_successful) {
430
428
return false ;
431
429
}
0 commit comments