The code was wrong because of a rogue "whitespace" in the if, and
overriding the attribute of ssl module that was already defined, could
result in segfaults of python.
... | ... |
@@ -26,10 +26,11 @@ from .Config import Config |
26 | 26 |
from .Exceptions import ParameterError |
27 | 27 |
from .Utils import getBucketFromHostname |
28 | 28 |
|
29 |
-if not 'CertificateError ' in ssl.__dict__: |
|
29 |
+if not 'CertificateError' in ssl.__dict__: |
|
30 | 30 |
class CertificateError(Exception): |
31 | 31 |
pass |
32 |
- ssl.CertificateError = CertificateError |
|
32 |
+else: |
|
33 |
+ CertificateError = ssl.CertificateError |
|
33 | 34 |
|
34 | 35 |
__all__ = [ "ConnMan" ] |
35 | 36 |
|
... | ... |
@@ -131,7 +132,7 @@ class http_connection(object): |
131 | 131 |
return |
132 | 132 |
except ValueError: # empty SSL cert means underlying SSL library didn't validate it, we don't either. |
133 | 133 |
return |
134 |
- except ssl.CertificateError as e: |
|
134 |
+ except CertificateError as e: |
|
135 | 135 |
if not self.forgive_wildcard_cert(cert, self.hostname): |
136 | 136 |
raise e |
137 | 137 |
|
... | ... |
@@ -41,7 +41,7 @@ from .Config import Config |
41 | 41 |
from .Exceptions import * |
42 | 42 |
from .MultiPart import MultiPartUpload |
43 | 43 |
from .S3Uri import S3Uri |
44 |
-from .ConnMan import ConnMan, CertificateError |
|
44 |
+from .ConnMan import ConnMan |
|
45 | 45 |
from .Crypto import (sign_request_v2, sign_request_v4, checksum_sha256_file, |
46 | 46 |
checksum_sha256_buffer, s3_quote, format_param_str) |
47 | 47 |
|