pull: Allow additional HTTP headers for summary fetch
Read the http-headers (a(ss)) option in ostree_repo_remote_fetch_summary_with_options like ostree_repo_pull_with_options and add the headers to the fetcher. This allows things like providing additional authorization headers to the HTTP requests. Closes: #839 Approved by: cgwalters
This commit is contained in:
parent
37b8dae2c4
commit
4e13361c8e
|
|
@ -2460,10 +2460,14 @@ repo_remote_fetch_summary (OstreeRepo *self,
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gboolean from_cache = FALSE;
|
gboolean from_cache = FALSE;
|
||||||
const char *url_override = NULL;
|
const char *url_override = NULL;
|
||||||
|
g_autoptr(GVariant) extra_headers = NULL;
|
||||||
g_autoptr(GPtrArray) mirrorlist = NULL;
|
g_autoptr(GPtrArray) mirrorlist = NULL;
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
(void) g_variant_lookup (options, "override-url", "&s", &url_override);
|
{
|
||||||
|
(void) g_variant_lookup (options, "override-url", "&s", &url_override);
|
||||||
|
(void) g_variant_lookup (options, "http-headers", "@a(ss)", &extra_headers);
|
||||||
|
}
|
||||||
|
|
||||||
mainctx = g_main_context_new ();
|
mainctx = g_main_context_new ();
|
||||||
g_main_context_push_thread_default (mainctx);
|
g_main_context_push_thread_default (mainctx);
|
||||||
|
|
@ -2472,6 +2476,9 @@ repo_remote_fetch_summary (OstreeRepo *self,
|
||||||
if (fetcher == NULL)
|
if (fetcher == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
if (extra_headers)
|
||||||
|
_ostree_fetcher_set_extra_headers (fetcher, extra_headers);
|
||||||
|
|
||||||
{
|
{
|
||||||
g_autofree char *url_string = NULL;
|
g_autofree char *url_string = NULL;
|
||||||
if (metalink_url_string)
|
if (metalink_url_string)
|
||||||
|
|
@ -3584,6 +3591,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||||
* The following are currently defined:
|
* The following are currently defined:
|
||||||
*
|
*
|
||||||
* - override-url (s): Fetch summary from this URL if remote specifies no metalink in options
|
* - override-url (s): Fetch summary from this URL if remote specifies no metalink in options
|
||||||
|
* - http-headers (a(ss)): Additional headers to add to all HTTP requests
|
||||||
*
|
*
|
||||||
* Returns: %TRUE on success, %FALSE on failure
|
* Returns: %TRUE on success, %FALSE on failure
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue