forked from pool/python-httplib2
1 OBS-URL: https://build.opensuse.org/request/show/487690 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httplib2?expand=0&rev=63
84 lines
3.4 KiB
Diff
84 lines
3.4 KiB
Diff
Index: httplib2-0.9.2/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
|
|
# requesting that URI again.
|
|
DEFAULT_MAX_REDIRECTS = 5
|
|
|
|
-try:
|
|
- # Users can optionally provide a module that tells us where the CA_CERTS
|
|
- # are located.
|
|
- import ca_certs_locater
|
|
- CA_CERTS = ca_certs_locater.get()
|
|
-except ImportError:
|
|
- # Default CA certificates file bundled with httplib2.
|
|
- CA_CERTS = os.path.join(
|
|
- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
|
|
+# Default CA certificates file bundled with httplib2.
|
|
+CA_CERTS = None
|
|
|
|
# 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
|
|
cert_file=cert_file, strict=strict)
|
|
self.timeout = timeout
|
|
self.proxy_info = proxy_info
|
|
- if ca_certs is None:
|
|
- ca_certs = CA_CERTS
|
|
self.ca_certs = ca_certs
|
|
self.disable_ssl_certificate_validation = \
|
|
disable_ssl_certificate_validation
|
|
Index: httplib2-0.9.2/python3/httplib2/__init__.py
|
|
===================================================================
|
|
--- httplib2-0.9.2.orig/python3/httplib2/__init__.py
|
|
+++ httplib2-0.9.2/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']
|
|
|
|
# Default CA certificates file bundled with httplib2.
|
|
-CA_CERTS = os.path.join(
|
|
- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
|
|
+CA_CERTS = None
|
|
|
|
def _get_end2end_headers(response):
|
|
hopbyhop = list(HOP_BY_HOP)
|
|
@@ -838,16 +837,17 @@
|
|
# TODO: implement proxy_info
|
|
self.proxy_info = proxy_info
|
|
context = None
|
|
- if ca_certs is None:
|
|
- ca_certs = CA_CERTS
|
|
- if (cert_file or ca_certs):
|
|
+ if True:
|
|
if not hasattr(ssl, 'SSLContext'):
|
|
raise CertificateValidationUnsupportedInPython31()
|
|
- context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
|
- if disable_ssl_certificate_validation:
|
|
- context.verify_mode = ssl.CERT_NONE
|
|
- else:
|
|
- context.verify_mode = ssl.CERT_REQUIRED
|
|
+
|
|
+ cafile = ca_certs
|
|
+ capath = None
|
|
+ if cafile is not None and os.path.isdir(cafile):
|
|
+ cafile = None
|
|
+ capath = ca_certs
|
|
+
|
|
+ context = ssl.create_default_context(cafile=cafile, capath=capath)
|
|
if cert_file:
|
|
context.load_cert_chain(cert_file, key_file)
|
|
if ca_certs:
|
|
Index: httplib2-0.9.2/setup.py
|
|
===================================================================
|
|
--- httplib2-0.9.2.orig/setup.py
|
|
+++ httplib2-0.9.2/setup.py
|
|
@@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``h
|
|
""",
|
|
package_dir=pkgdir,
|
|
packages=['httplib2'],
|
|
- package_data={'httplib2': ['*.txt']},
|
|
classifiers=[
|
|
'Development Status :: 4 - Beta',
|
|
'Environment :: Web Environment',
|