summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-03-31 16:39:22 +0200
committerLinus Nordberg <linus@nordberg.se>2015-03-31 16:39:22 +0200
commite4476f7e71e0ebbfe5594bc90d22a9d74d638211 (patch)
treefa041ea5d63857231e24a7611ba441fba96deb39
parent064556bd0e531c71dd285de372312d2851abf29f (diff)
Pass an SSL context to urrllib2.
-rw-r--r--tools/certtools.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/certtools.py b/tools/certtools.py
index da5021a..498a2e0 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -90,8 +90,8 @@ def get_root_cert(issuer):
def urlopen(url, data=None):
try:
- opener = urllib2.build_opener(urllib2.HTTPSHandler(context=None))
- except TypeError:
+ opener = urllib2.build_opener(urllib2.HTTPSHandler(context=ssl.SSLContext(ssl.PROTOCOL_TLSv1)))
+ except AttributeError:
opener = urllib2.build_opener(urllib2.HTTPSHandler())
return opener.open(url, data)
@@ -239,8 +239,8 @@ def check_auth_header(authheader, expected_key, publickeydir, data, path):
def http_request(url, data=None, key=None, verifynode=None, publickeydir="."):
try:
- opener = urllib2.build_opener(urllib2.HTTPSHandler(context=None))
- except TypeError:
+ opener = urllib2.build_opener(urllib2.HTTPSHandler(context=ssl.SSLContext(ssl.PROTOCOL_TLSv1)))
+ except AttributeError:
opener = urllib2.build_opener(urllib2.HTTPSHandler())
(keyname, keyfile) = key