summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-pull.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2020-09-10 11:34:31 +0200
committerAlexander Larsson <alexl@redhat.com>2020-09-11 12:03:28 +0200
commit155b215cd86514c300ba573665dc8320c0c72852 (patch)
tree363052e7356dba9c1486a92c81f3fcf243cb830e /src/libostree/ostree-repo-pull.c
parent3957bff0cb2818bf65adf6db969553d220b6608f (diff)
downloadostree-155b215cd86514c300ba573665dc8320c0c72852.tar.gz
Minor cleanup of _ostree_repo_remote_new_fetcher()
Instead of open coding the extra_headers and append_user_agent setting everywhere we do this in the constructor.
Diffstat (limited to 'src/libostree/ostree-repo-pull.c')
-rw-r--r--src/libostree/ostree-repo-pull.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 61700e47..21092cd7 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -2824,6 +2824,8 @@ static OstreeFetcher *
_ostree_repo_remote_new_fetcher (OstreeRepo *self,
const char *remote_name,
gboolean gzip,
+ GVariant *extra_headers,
+ const char *append_user_agent,
OstreeFetcherSecurityState *out_state,
GError **error)
{
@@ -2937,6 +2939,12 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
_ostree_fetcher_set_cookie_jar (fetcher, jar_path);
}
+ if (extra_headers)
+ _ostree_fetcher_set_extra_headers (fetcher, extra_headers);
+
+ if (append_user_agent)
+ _ostree_fetcher_set_extra_user_agent (fetcher, append_user_agent);
+
success = TRUE;
out:
@@ -3092,17 +3100,13 @@ reinitialize_fetcher (OtPullData *pull_data, const char *remote_name,
{
g_clear_object (&pull_data->fetcher);
pull_data->fetcher = _ostree_repo_remote_new_fetcher (pull_data->repo, remote_name, FALSE,
+ pull_data->extra_headers,
+ pull_data->append_user_agent,
&pull_data->fetcher_security_state,
error);
if (pull_data->fetcher == NULL)
return FALSE;
- if (pull_data->extra_headers)
- _ostree_fetcher_set_extra_headers (pull_data->fetcher, pull_data->extra_headers);
-
- if (pull_data->append_user_agent)
- _ostree_fetcher_set_extra_user_agent (pull_data->fetcher, pull_data->append_user_agent);
-
return TRUE;
}
@@ -5454,7 +5458,7 @@ find_remotes_cb (GObject *obj,
goto error;
fetcher = _ostree_repo_remote_new_fetcher (self, result->remote->name,
- TRUE, NULL, &error);
+ TRUE, NULL, NULL, NULL, &error);
if (fetcher == NULL)
goto error;
@@ -6110,16 +6114,10 @@ ostree_repo_remote_fetch_summary_with_options (OstreeRepo *self,
mainctx = _ostree_main_context_new_default ();
- fetcher = _ostree_repo_remote_new_fetcher (self, name, TRUE, NULL, error);
+ fetcher = _ostree_repo_remote_new_fetcher (self, name, TRUE, extra_headers, append_user_agent, NULL, error);
if (fetcher == NULL)
return FALSE;
- if (extra_headers)
- _ostree_fetcher_set_extra_headers (fetcher, extra_headers);
-
- if (append_user_agent)
- _ostree_fetcher_set_extra_user_agent (fetcher, append_user_agent);
-
{
g_autofree char *url_string = NULL;
if (metalink_url_string)