Accepting request 580064 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/580064
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-httplib2?expand=0&rev=42
This commit is contained in:
Dominique Leuenberger 2018-02-27 15:58:40 +00:00 committed by Git OBS Bridge
commit 761a97b545
2 changed files with 31 additions and 18 deletions

View File

@ -1,8 +1,8 @@
Index: httplib2-0.10.3/python2/httplib2/__init__.py diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
=================================================================== index 32ec959..cf7f2f9 100644
--- httplib2-0.10.3.orig/python2/httplib2/__init__.py --- a/python2/httplib2/__init__.py
+++ httplib2-0.10.3/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py
@@ -83,11 +83,18 @@ def _ssl_wrap_socket(sock, key_file, cer @@ -83,11 +83,20 @@ def _ssl_wrap_socket(sock, key_file, cert_file, disable_validation,
cert_reqs = ssl.CERT_NONE cert_reqs = ssl.CERT_NONE
else: else:
cert_reqs = ssl.CERT_REQUIRED cert_reqs = ssl.CERT_REQUIRED
@ -19,13 +19,15 @@ Index: httplib2-0.10.3/python2/httplib2/__init__.py
+ +
+ if ssl_version is None: + if ssl_version is None:
+ context = ssl.create_default_context(cafile=cafile, capath=capath) + context = ssl.create_default_context(cafile=cafile, capath=capath)
+ if disable_validation:
+ context.check_hostname = False
+ else: + else:
+ context = ssl.SSLContext(ssl_version) + context = ssl.SSLContext(ssl_version)
+ +
context.verify_mode = cert_reqs context.verify_mode = cert_reqs
context.check_hostname = (cert_reqs != ssl.CERT_NONE) context.check_hostname = (cert_reqs != ssl.CERT_NONE)
if cert_file: if cert_file:
@@ -96,6 +103,9 @@ def _ssl_wrap_socket(sock, key_file, cer @@ -96,6 +105,9 @@ def _ssl_wrap_socket(sock, key_file, cert_file, disable_validation,
context.load_verify_locations(ca_certs) context.load_verify_locations(ca_certs)
return context.wrap_socket(sock, server_hostname=hostname) return context.wrap_socket(sock, server_hostname=hostname)
else: else:
@ -35,7 +37,7 @@ Index: httplib2-0.10.3/python2/httplib2/__init__.py
return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file, return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
cert_reqs=cert_reqs, ca_certs=ca_certs, cert_reqs=cert_reqs, ca_certs=ca_certs,
ssl_version=ssl_version) ssl_version=ssl_version)
@@ -210,15 +220,8 @@ class NotRunningAppEngineEnvironment(Htt @@ -210,15 +222,8 @@ class NotRunningAppEngineEnvironment(HttpLib2Error): pass
# requesting that URI again. # requesting that URI again.
DEFAULT_MAX_REDIRECTS = 5 DEFAULT_MAX_REDIRECTS = 5
@ -53,7 +55,7 @@ Index: httplib2-0.10.3/python2/httplib2/__init__.py
# Which headers are hop-by-hop headers by default # Which headers are hop-by-hop headers by default
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
@@ -975,8 +978,6 @@ class HTTPSConnectionWithTimeout(httplib @@ -975,8 +980,6 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
cert_file=cert_file, strict=strict) cert_file=cert_file, strict=strict)
self.timeout = timeout self.timeout = timeout
self.proxy_info = proxy_info self.proxy_info = proxy_info
@ -62,10 +64,10 @@ Index: httplib2-0.10.3/python2/httplib2/__init__.py
self.ca_certs = ca_certs self.ca_certs = ca_certs
self.disable_ssl_certificate_validation = \ self.disable_ssl_certificate_validation = \
disable_ssl_certificate_validation disable_ssl_certificate_validation
Index: httplib2-0.10.3/python3/httplib2/__init__.py diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
=================================================================== index 0000ed9..40f4556 100644
--- httplib2-0.10.3.orig/python3/httplib2/__init__.py --- a/python3/httplib2/__init__.py
+++ httplib2-0.10.3/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py
@@ -124,8 +124,7 @@ DEFAULT_MAX_REDIRECTS = 5 @@ -124,8 +124,7 @@ DEFAULT_MAX_REDIRECTS = 5
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade'] HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
@ -76,7 +78,7 @@ Index: httplib2-0.10.3/python3/httplib2/__init__.py
def _get_end2end_headers(response): def _get_end2end_headers(response):
hopbyhop = list(HOP_BY_HOP) hopbyhop = list(HOP_BY_HOP)
@@ -838,16 +837,17 @@ class HTTPSConnectionWithTimeout(http.cl @@ -838,16 +837,17 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection):
# TODO: implement proxy_info # TODO: implement proxy_info
self.proxy_info = proxy_info self.proxy_info = proxy_info
context = None context = None
@ -102,11 +104,11 @@ Index: httplib2-0.10.3/python3/httplib2/__init__.py
if cert_file: if cert_file:
context.load_cert_chain(cert_file, key_file) context.load_cert_chain(cert_file, key_file)
if ca_certs: if ca_certs:
Index: httplib2-0.10.3/setup.py diff --git a/setup.py b/setup.py
=================================================================== index 9c8c86c..34ea20a 100755
--- httplib2-0.10.3.orig/setup.py --- a/setup.py
+++ httplib2-0.10.3/setup.py +++ b/setup.py
@@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``h @@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``httplib2`` supports many features left ou
""", """,
package_dir=pkgdir, package_dir=pkgdir,
packages=['httplib2'], packages=['httplib2'],

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Feb 23 16:31:07 UTC 2018 - snica@suse.com
- update httplib2-use-system-certs.patch: handle
the case when validation is disabled correctly.
The 'check_hostname' context attribute has to be
set first, othewise a "ValueError: Cannot set
verify_mode to CERT_NONE when check_hostname
is enabled." exception is raised.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 10 07:47:54 UTC 2018 - dmueller@suse.com Wed Jan 10 07:47:54 UTC 2018 - dmueller@suse.com