Use a functionality check on the SSL module instead of checking version numbers, since there are distros out there that backport patches without changing version numbers

This commit is contained in:
Kovid Goyal 2014-12-16 09:30:01 +05:30
parent 6a349b9c30
commit b5849698c0
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ py3 = sys.version_info[0] > 2
enc = getattr(sys.stdout, 'encoding', 'UTF-8') or 'utf-8' enc = getattr(sys.stdout, 'encoding', 'UTF-8') or 'utf-8'
calibre_version = signature = None calibre_version = signature = None
urllib = __import__('urllib.request' if py3 else 'urllib', fromlist=1) urllib = __import__('urllib.request' if py3 else 'urllib', fromlist=1)
has_ssl_verify = sys.version_info[:3] >= (2, 7, 9) has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2')
if py3: if py3:
unicode = str unicode = str

View File

@ -6,12 +6,12 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import ssl, socket, re, sys import ssl, socket, re
from contextlib import closing from contextlib import closing
from calibre import get_proxies from calibre import get_proxies
from calibre.constants import ispy3 from calibre.constants import ispy3
has_ssl_verify = sys.version_info[:3] >= (2, 7, 9) has_ssl_verify = hasattr(ssl, 'PROTOCOL_TLSv1_2')
class HTTPError(ValueError): class HTTPError(ValueError):