Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
99ba9d6e
Commit
99ba9d6e
authored
Aug 28, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default fetch_url to use TLSv1 instead of SSLv2/3
parent
984d5512
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
lib/ansible/module_utils/urls.py
+20
-0
No files found.
lib/ansible/module_utils/urls.py
View file @
99ba9d6e
...
...
@@ -50,6 +50,7 @@ try:
except
:
HAS_SSL
=
False
import
httplib
import
os
import
re
import
socket
...
...
@@ -79,6 +80,23 @@ zKPZsZ2miVGclicJHzm5q080b1p/sZtuKIEZk6vZqEg=
-----END CERTIFICATE-----
"""
class
CustomHTTPSConnection
(
httplib
.
HTTPSConnection
):
def
connect
(
self
):
"Connect to a host on a given (SSL) port."
sock
=
socket
.
create_connection
((
self
.
host
,
self
.
port
),
self
.
timeout
,
self
.
source_address
)
if
self
.
_tunnel_host
:
self
.
sock
=
sock
self
.
_tunnel
()
self
.
sock
=
ssl
.
wrap_socket
(
sock
,
keyfile
=
self
.
key_file
,
certfile
=
self
.
cert_file
,
ssl_version
=
ssl
.
PROTOCOL_TLSv1
)
class
CustomHTTPSHandler
(
urllib2
.
HTTPSHandler
):
def
https_open
(
self
,
req
):
return
self
.
do_open
(
CustomHTTPSConnection
,
req
)
https_request
=
urllib2
.
AbstractHTTPHandler
.
do_request_
def
generic_urlparse
(
parts
):
'''
Returns a dictionary of url parts as parsed by urlparse,
...
...
@@ -373,6 +391,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
proxyhandler
=
urllib2
.
ProxyHandler
({})
handlers
.
append
(
proxyhandler
)
handlers
.
append
(
CustomHTTPSHandler
)
opener
=
urllib2
.
build_opener
(
*
handlers
)
urllib2
.
install_opener
(
opener
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment