diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c index eefef5e8d5..7b6ee77f93 100644 --- a/src/libostree/ostree-fetcher-curl.c +++ b/src/libostree/ostree-fetcher-curl.c @@ -52,6 +52,7 @@ struct OstreeFetcher char *tls_client_cert_path; char *tls_client_key_path; char *cookie_jar_path; + char *proxy; struct curl_slist *extra_headers; int tmpdir_dfd; @@ -148,6 +149,7 @@ _ostree_fetcher_finalize (GObject *object) OstreeFetcher *self = OSTREE_FETCHER (object); g_free (self->cookie_jar_path); + g_free (self->proxy); g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0); g_clear_pointer (&self->extra_headers, (GDestroyNotify)curl_slist_free_all); g_hash_table_unref (self->outstanding_requests); @@ -594,6 +596,8 @@ void _ostree_fetcher_set_proxy (OstreeFetcher *self, const char *http_proxy) { + g_free (self->proxy); + self->proxy = g_strdup (http_proxy); } void @@ -700,6 +704,12 @@ initiate_next_curl_request (FetcherRequest *req, g_assert_cmpint (rc, ==, CURLM_OK); } + if (self->proxy) + { + rc = curl_easy_setopt (req->easy, CURLOPT_PROXY, self->proxy); + g_assert_cmpint (rc, ==, CURLM_OK); + } + if (self->tls_ca_db_path) curl_easy_setopt (req->easy, CURLOPT_CAINFO, self->tls_ca_db_path);