|
|
@ -358,16 +358,12 @@ def url_filename(url):
|
|
|
|
return fn
|
|
|
|
return fn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def url_get(module, url, dest, use_proxy, last_mod_time, force, timeout=10, headers=None, tmp_dest=''):
|
|
|
|
def url_get(module, url, dest, use_proxy, last_mod_time, force, timeout=10, headers=None, tmp_dest='', method='GET'):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Download data from the url and store in a temporary file.
|
|
|
|
Download data from the url and store in a temporary file.
|
|
|
|
|
|
|
|
|
|
|
|
Return (tempfile, info about the request)
|
|
|
|
Return (tempfile, info about the request)
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
if module.check_mode:
|
|
|
|
|
|
|
|
method = 'HEAD'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
method = 'GET'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = datetime.datetime.utcnow()
|
|
|
|
start = datetime.datetime.utcnow()
|
|
|
|
rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time, timeout=timeout, headers=headers, method=method)
|
|
|
|
rsp, info = fetch_url(module, url, use_proxy=use_proxy, force=force, last_mod_time=last_mod_time, timeout=timeout, headers=headers, method=method)
|
|
|
@ -573,7 +569,8 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
# download to tmpsrc
|
|
|
|
# download to tmpsrc
|
|
|
|
start = datetime.datetime.utcnow()
|
|
|
|
start = datetime.datetime.utcnow()
|
|
|
|
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force, timeout, headers, tmp_dest)
|
|
|
|
method = 'HEAD' if module.check_mode else 'GET'
|
|
|
|
|
|
|
|
tmpsrc, info = url_get(module, url, dest, use_proxy, last_mod_time, force, timeout, headers, tmp_dest, method)
|
|
|
|
result['elapsed'] = (datetime.datetime.utcnow() - start).seconds
|
|
|
|
result['elapsed'] = (datetime.datetime.utcnow() - start).seconds
|
|
|
|
result['src'] = tmpsrc
|
|
|
|
result['src'] = tmpsrc
|
|
|
|
|
|
|
|
|
|
|
|