mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Set default user-agent for module_utils.urls fetch_url (#27095)
The HTTP User-Agent "ansible-httpget" is already kind of the default, it being the default value provided by the `url_argument_spec` helper method. Yet, it may not be practical for all modules to get their argument_spec that way. Without a default User-Agent we fall back on the library User-Agent. That being something like "Python-urllib/2.7". While I'm no big fan of web servers making decisions based on the provided User-Agent I still think that part of being a well-behaved HTTP client is to provide an informative User-Agent. Not to mention that it's a good thing for Ansible to behave consistently. Indirectly fixes #26239
This commit is contained in:
parent
7c65272e2d
commit
063f5d0ca8
1 changed files with 1 additions and 1 deletions
|
@ -1020,7 +1020,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
|||
|
||||
username = module.params.get('url_username', '')
|
||||
password = module.params.get('url_password', '')
|
||||
http_agent = module.params.get('http_agent', None)
|
||||
http_agent = module.params.get('http_agent', 'ansible-httpget')
|
||||
force_basic_auth = module.params.get('force_basic_auth', '')
|
||||
|
||||
follow_redirects = module.params.get('follow_redirects', 'urllib2')
|
||||
|
|
Loading…
Reference in a new issue