Merge "Update HTTPS certificate handling for pep-0476"
This commit is contained in:
@@ -149,7 +149,11 @@ class VerifiedHTTPSConnection(HTTPSConnection):
|
|||||||
if six.PY3:
|
if six.PY3:
|
||||||
excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
|
excp_lst = (TypeError, FileNotFoundError, ssl.SSLError)
|
||||||
else:
|
else:
|
||||||
excp_lst = ()
|
# NOTE(jamespage)
|
||||||
|
# Accomodate changes in behaviour for pep-0467, introduced
|
||||||
|
# in python 2.7.9.
|
||||||
|
# https://github.com/python/peps/blob/master/pep-0476.txt
|
||||||
|
excp_lst = (TypeError, IOError, ssl.SSLError)
|
||||||
try:
|
try:
|
||||||
HTTPSConnection.__init__(self, host, port,
|
HTTPSConnection.__init__(self, host, port,
|
||||||
key_file=key_file,
|
key_file=key_file,
|
||||||
|
@@ -109,8 +109,10 @@ class TestVerifiedHTTPSConnection(testtools.TestCase):
|
|||||||
"""
|
"""
|
||||||
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
|
cert_file = os.path.join(TEST_VAR_DIR, 'certificate.crt')
|
||||||
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
|
cacert = os.path.join(TEST_VAR_DIR, 'ca.crt')
|
||||||
|
key_file = os.path.join(TEST_VAR_DIR, 'badkey.key')
|
||||||
try:
|
try:
|
||||||
https.VerifiedHTTPSConnection('127.0.0.1', 0,
|
https.VerifiedHTTPSConnection('127.0.0.1', 0,
|
||||||
|
key_file=key_file,
|
||||||
cert_file=cert_file,
|
cert_file=cert_file,
|
||||||
cacert=cacert)
|
cacert=cacert)
|
||||||
self.fail('Failed to raise assertion.')
|
self.fail('Failed to raise assertion.')
|
||||||
|
Reference in New Issue
Block a user