Skip to content

Commit 13c9a33

Browse files
authored
arg : remove CURLINFO_EFFECTIVE_METHOD (#13228)
1 parent a70183e commit 13c9a33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

common/arg.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,11 @@ struct curl_slist_ptr {
217217
#define CURL_MAX_RETRY 3
218218
#define CURL_RETRY_DELAY_SECONDS 2
219219

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) {
221221
int remaining_attempts = max_attempts;
222-
char * method = nullptr;
223-
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_METHOD, &method);
224222

225223
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);
227225

228226
CURLcode res = curl_easy_perform(curl);
229227
if (res == CURLE_OK) {
@@ -343,7 +341,7 @@ static bool common_download_file_single(const std::string & url, const std::stri
343341

344342
// we only allow retrying once for HEAD requests
345343
// 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");
347345
if (!was_perform_successful) {
348346
head_request_ok = false;
349347
}
@@ -425,7 +423,7 @@ static bool common_download_file_single(const std::string & url, const std::stri
425423
// start the download
426424
LOG_INF("%s: trying to download model from %s to %s (server_etag:%s, server_last_modified:%s)...\n", __func__,
427425
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");
429427
if (!was_perform_successful) {
430428
return false;
431429
}

0 commit comments

Comments
 (0)