sources/curl: use --user-agent option to set the user-agent

Setting the user-agent using `--header` is broken in combination with
`--location`, `--proxy`, and an https endpoint which redirects. The
user-agent sent to the proxy changes after the client is redirected,
tripping up proxies.

For more information see https://issues.redhat.com/browse/RHEL-45364
This commit is contained in:
Sanne Raymaekers 2024-06-27 22:26:46 +02:00
parent 8db6b8985a
commit 2e5a9335c9
2 changed files with 3 additions and 3 deletions

View file

@ -222,6 +222,6 @@ def test_curl_user_agent(mocked_run, tmp_path, sources_service):
for call_args in mocked_run.call_args_list:
args, _kwargs = call_args
idx = args[0].index("--header")
assert "User-Agent: osbuild" in args[0][idx + 1]
idx = args[0].index("--user-agent")
assert "osbuild" in args[0][idx + 1]
assert "https://osbuild.org/" in args[0][idx + 1]