diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c index af9760220e..422ed41649 100644 --- a/src/libostree/ostree-fetcher-curl.c +++ b/src/libostree/ostree-fetcher-curl.c @@ -79,6 +79,9 @@ struct OstreeFetcher int tmpdir_dfd; bool force_anonymous; char *custom_user_agent; + long opt_low_speed_limit; + long opt_low_speed_time; + gboolean opt_retry_all; GMainContext *mainctx; CURLM *multi; @@ -183,6 +186,9 @@ _ostree_fetcher_finalize (GObject *object) g_free (self->tls_client_key_path); g_free (self->cookie_jar_path); g_free (self->proxy); + g_free (self->opt_low_speed_limit); + g_free (self->opt_low_speed_time); + g_free (self->opt_retry_all); g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0); g_clear_pointer (&self->extra_headers, curl_slist_free_all); g_hash_table_unref (self->outstanding_requests); @@ -333,7 +339,8 @@ check_multi_info (OstreeFetcher *fetcher) /* When it is not a file, we want to retry the request. * We accomplish that by using G_IO_ERROR_TIMED_OUT. */ - int g_io_error_code = is_file ? G_IO_ERROR_FAILED : G_IO_ERROR_TIMED_OUT; + gboolean opt_retry_all = req->fetcher->opt_retry_all; + int g_io_error_code = (is_file || !opt_retry_all) ? 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)); @@ -916,9 +923,9 @@ initiate_next_curl_request (FetcherRequest *req, GTask *task) g_assert_cmpint (rc, ==, CURLM_OK); rc = curl_easy_setopt (req->easy, CURLOPT_CONNECTTIMEOUT, 30L); g_assert_cmpint (rc, ==, CURLM_OK); - rc = curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_LIMIT, low_speed_limit); + rc = curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_LIMIT, req->fetcher->opt_low_speed_limit); g_assert_cmpint (rc, ==, CURLM_OK); - rc = curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_TIME, low_speed_time); + rc = curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_TIME, req->fetcher->opt_low_speed_time); g_assert_cmpint (rc, ==, CURLM_OK); /* closure bindings -> task */ rc = curl_easy_setopt (req->easy, CURLOPT_PRIVATE, task);