aboutsummaryrefslogtreecommitdiff
path: root/urllib3
diff options
context:
space:
mode:
authorStefano Rivera <stefanor@debian.org>2015-10-08 13:19:51 -0700
committerChristopher Baines <mail@cbaines.net>2015-12-22 14:14:10 +0000
commit24ae6ba32069ca15f4a163e386964a3accdccf63 (patch)
treef5ec8445549d48bf2aa5447cd44cac3a2ca053cc /urllib3
parent11c93ac43225db29b9c7ead00e704ce97a11f89c (diff)
downloadpython-urllib3-24ae6ba32069ca15f4a163e386964a3accdccf63.tar
python-urllib3-24ae6ba32069ca15f4a163e386964a3accdccf63.tar.gz
Do not use embedded copy of ssl.match_hostname, when possible
The system python has the necessary features backported, since 2.7.8-7 (and 221a1f9155e2, releasing in 2.7.9, upstream). However, alternative python implementations don't, yet, and urllib3 is used by pip in virtualenvs. Forwarded: not-needed Last-Update: 2014-11-18 Patch-Name: 05_avoid-embedded-ssl-match-hostname.patch
Diffstat (limited to 'urllib3')
-rw-r--r--urllib3/packages/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/urllib3/packages/__init__.py b/urllib3/packages/__init__.py
index 170e974..35555ed 100644
--- a/urllib3/packages/__init__.py
+++ b/urllib3/packages/__init__.py
@@ -1,5 +1,11 @@
from __future__ import absolute_import
-from . import ssl_match_hostname
+try:
+ # cPython >= 2.7.9 has ssl features backported from Python3
+ from ssl import CertificateError
+ del CertificateError
+ import ssl as ssl_match_hostname
+except ImportError:
+ from . import ssl_match_hostname
__all__ = ('ssl_match_hostname', )