File: 05_avoid-embedded-ssl-match-hostname.patch

package info (click to toggle)
python-urllib3 1.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,228 kB
  • ctags: 1,135
  • sloc: python: 5,736; makefile: 155
file content (22 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Description: 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.
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: not-needed
Last-Update: 2014-11-18

--- a/urllib3/packages/__init__.py
+++ b/urllib3/packages/__init__.py
@@ -1,4 +1,9 @@
 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