mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
uri: Add redirect tests for none, safe, urllib2 and all (#37068)
This is required if we want to ensure that #36809 doesn't cause any important behavioral changes. This PR changes the uri module to support follow_redirects=urllib2 It also adds a better error message when the connection closes before any data was returned.
This commit is contained in:
parent
fea8c84a17
commit
800dad5bdf
7 changed files with 1105 additions and 8 deletions
|
@ -1050,6 +1050,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
|
|||
info.update(dict(msg="Request failed: %s" % to_native(e), status=code))
|
||||
except socket.error as e:
|
||||
info.update(dict(msg="Connection failure: %s" % to_native(e), status=-1))
|
||||
except httplib.BadStatusLine as e:
|
||||
info.update(dict(msg="Connection failure: connection was closed before a valid response was received: %s" % to_native(e.line), status=-1))
|
||||
except Exception as e:
|
||||
info.update(dict(msg="An unknown error occurred: %s" % to_native(e), status=-1),
|
||||
exception=traceback.format_exc())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue