Merge pull request #14852 from sivel/fix-redirects-get-url
Fix redirects get url
This commit is contained in:
commit
bb23304b10
4 changed files with 10 additions and 7 deletions
|
@ -676,7 +676,7 @@ def maybe_add_ssl_handler(url, validate_certs):
|
||||||
def open_url(url, data=None, headers=None, method=None, use_proxy=True,
|
def open_url(url, data=None, headers=None, method=None, use_proxy=True,
|
||||||
force=False, last_mod_time=None, timeout=10, validate_certs=True,
|
force=False, last_mod_time=None, timeout=10, validate_certs=True,
|
||||||
url_username=None, url_password=None, http_agent=None,
|
url_username=None, url_password=None, http_agent=None,
|
||||||
force_basic_auth=False, follow_redirects=False):
|
force_basic_auth=False, follow_redirects='urllib2'):
|
||||||
'''
|
'''
|
||||||
Fetches a file from an HTTP/FTP server using urllib2
|
Fetches a file from an HTTP/FTP server using urllib2
|
||||||
'''
|
'''
|
||||||
|
@ -809,8 +809,7 @@ def url_argument_spec():
|
||||||
)
|
)
|
||||||
|
|
||||||
def fetch_url(module, url, data=None, headers=None, method=None,
|
def fetch_url(module, url, data=None, headers=None, method=None,
|
||||||
use_proxy=True, force=False, last_mod_time=None, timeout=10,
|
use_proxy=True, force=False, last_mod_time=None, timeout=10):
|
||||||
follow_redirects=False):
|
|
||||||
'''
|
'''
|
||||||
Fetches a file from an HTTP/FTP server using urllib2. Requires the module environment
|
Fetches a file from an HTTP/FTP server using urllib2. Requires the module environment
|
||||||
'''
|
'''
|
||||||
|
@ -828,8 +827,7 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
||||||
http_agent = module.params.get('http_agent', None)
|
http_agent = module.params.get('http_agent', None)
|
||||||
force_basic_auth = module.params.get('force_basic_auth', '')
|
force_basic_auth = module.params.get('force_basic_auth', '')
|
||||||
|
|
||||||
if not follow_redirects:
|
follow_redirects = module.params.get('follow_redirects', 'urllib2')
|
||||||
follow_redirects = module.params.get('follow_redirects', False)
|
|
||||||
|
|
||||||
r = None
|
r = None
|
||||||
info = dict(url=url)
|
info = dict(url=url)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0bbb7ba38da07d2a9e562834264a2ee2fc9ceaf4
|
Subproject commit 45745424f702980a8860ab5ba2d94cdfd0311695
|
|
@ -1 +1 @@
|
||||||
Subproject commit 39e4040685bf2c36fd59450ac4f9b40158179f9e
|
Subproject commit b51efc51bc64ef99b389acb6166d0eb46d984085
|
|
@ -145,3 +145,8 @@
|
||||||
- 'get_url_result["failed"]'
|
- 'get_url_result["failed"]'
|
||||||
when: "{{ not python_has_ssl_context }}"
|
when: "{{ not python_has_ssl_context }}"
|
||||||
# End hacky SNI test section
|
# End hacky SNI test section
|
||||||
|
|
||||||
|
- name: Test get_url with redirect
|
||||||
|
get_url:
|
||||||
|
url: 'http://httpbin.org/redirect/6'
|
||||||
|
dest: "{{ output_dir }}/redirect.json"
|
||||||
|
|
Loading…
Reference in a new issue