- update httplib2-use-system-certs.patch: Also use

ssl.create_default_context in the python2 case so that
  the system wide certificates are loaded as trusted again.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httplib2?expand=0&rev=69
This commit is contained in:
Dirk Mueller 2018-01-09 11:05:33 +00:00 committed by Git OBS Bridge
parent 0fcb096fd6
commit bffbdd4e27
3 changed files with 40 additions and 13 deletions

View File

@ -1,8 +1,27 @@
Index: httplib2-0.9.2/python2/httplib2/__init__.py
Index: httplib2-0.10.3/python2/httplib2/__init__.py
===================================================================
--- httplib2-0.9.2.orig/python2/httplib2/__init__.py
+++ httplib2-0.9.2/python2/httplib2/__init__.py
@@ -184,15 +184,8 @@ class CertificateHostnameMismatch(SSLHan
--- httplib2-0.10.3.orig/python2/httplib2/__init__.py
+++ httplib2-0.10.3/python2/httplib2/__init__.py
@@ -87,7 +87,17 @@ def _ssl_wrap_socket(sock, key_file, cer
ssl_version = ssl.PROTOCOL_SSLv23
if hasattr(ssl, 'SSLContext'): # Python 2.7.9
- context = ssl.SSLContext(ssl_version)
+ cafile = ca_certs
+ capath = None
+ if cafile is not None and os.path.isdir(cafile):
+ cafile = None
+ capath = ca_certs
+
+ if ssl_version is None:
+ context = ssl.create_default_context(cafile=cafile, capath=capath)
+ else:
+ context = ssl.SSLContext(ssl_version)
+
context.verify_mode = cert_reqs
context.check_hostname = (cert_reqs != ssl.CERT_NONE)
if cert_file:
@@ -210,15 +220,8 @@ class NotRunningAppEngineEnvironment(Htt
# requesting that URI again.
DEFAULT_MAX_REDIRECTS = 5
@ -20,7 +39,7 @@ Index: httplib2-0.9.2/python2/httplib2/__init__.py
# Which headers are hop-by-hop headers by default
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
@@ -944,8 +937,6 @@ class HTTPSConnectionWithTimeout(httplib
@@ -975,8 +978,6 @@ class HTTPSConnectionWithTimeout(httplib
cert_file=cert_file, strict=strict)
self.timeout = timeout
self.proxy_info = proxy_info
@ -29,10 +48,10 @@ Index: httplib2-0.9.2/python2/httplib2/__init__.py
self.ca_certs = ca_certs
self.disable_ssl_certificate_validation = \
disable_ssl_certificate_validation
Index: httplib2-0.9.2/python3/httplib2/__init__.py
Index: httplib2-0.10.3/python3/httplib2/__init__.py
===================================================================
--- httplib2-0.9.2.orig/python3/httplib2/__init__.py
+++ httplib2-0.9.2/python3/httplib2/__init__.py
--- httplib2-0.10.3.orig/python3/httplib2/__init__.py
+++ httplib2-0.10.3/python3/httplib2/__init__.py
@@ -124,8 +124,7 @@ DEFAULT_MAX_REDIRECTS = 5
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
@ -43,7 +62,7 @@ Index: httplib2-0.9.2/python3/httplib2/__init__.py
def _get_end2end_headers(response):
hopbyhop = list(HOP_BY_HOP)
@@ -838,16 +837,17 @@
@@ -838,16 +837,17 @@ class HTTPSConnectionWithTimeout(http.cl
# TODO: implement proxy_info
self.proxy_info = proxy_info
context = None
@ -69,10 +88,10 @@ Index: httplib2-0.9.2/python3/httplib2/__init__.py
if cert_file:
context.load_cert_chain(cert_file, key_file)
if ca_certs:
Index: httplib2-0.9.2/setup.py
Index: httplib2-0.10.3/setup.py
===================================================================
--- httplib2-0.9.2.orig/setup.py
+++ httplib2-0.9.2/setup.py
--- httplib2-0.10.3.orig/setup.py
+++ httplib2-0.10.3/setup.py
@@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``h
""",
package_dir=pkgdir,

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jan 9 11:04:53 UTC 2018 - dmueller@suse.com
- update httplib2-use-system-certs.patch: Also use
ssl.create_default_context in the python2 case so that
the system wide certificates are loaded as trusted again.
-------------------------------------------------------------------
Wed Apr 19 22:13:57 UTC 2017 - toddrme2178@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-httplib2
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Tests require network connection
%bcond_with tests