diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c index be88c4ef9f..e373a0f88d 100644 --- a/src/libostree/ostree-fetcher-curl.c +++ b/src/libostree/ostree-fetcher-curl.c @@ -304,6 +304,7 @@ check_multi_info (OstreeFetcher *fetcher) const char *eff_url; gboolean is_file; gboolean continued_request = FALSE; + gboolean should_retry; if (msg->msg != CURLMSG_DONE) continue; @@ -330,7 +331,14 @@ check_multi_info (OstreeFetcher *fetcher) } else { - g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, + /* When it is not a file and the OSTREE_CURL_IO_RETRY + * environment variable is set, we want to retry the request. + * We accomplish that by using G_IO_ERROR_TIMED_OUT. + */ + should_retry = g_getenv ("OSTREE_CURL_IO_RETRY") != NULL; + int g_io_error_code + = (is_file || !should_retry) ? G_IO_ERROR_FAILED : G_IO_ERROR_TIMED_OUT; + g_task_return_new_error (task, G_IO_ERROR, g_io_error_code, "While fetching %s: [%u] %s", eff_url, curlres, curl_easy_strerror (curlres)); _ostree_fetcher_journal_failure (req->fetcher->remote_name, eff_url,