2018-01-09 12:05:33 +01:00
|
|
|
Index: httplib2-0.10.3/python2/httplib2/__init__.py
|
2016-03-15 21:06:26 +01:00
|
|
|
===================================================================
|
2018-01-09 12:05:33 +01:00
|
|
|
--- httplib2-0.10.3.orig/python2/httplib2/__init__.py
|
|
|
|
+++ httplib2-0.10.3/python2/httplib2/__init__.py
|
2018-01-10 08:47:00 +01:00
|
|
|
@@ -83,11 +83,18 @@ def _ssl_wrap_socket(sock, key_file, cer
|
|
|
|
cert_reqs = ssl.CERT_NONE
|
|
|
|
else:
|
|
|
|
cert_reqs = ssl.CERT_REQUIRED
|
|
|
|
- if ssl_version is None:
|
|
|
|
- ssl_version = ssl.PROTOCOL_SSLv23
|
|
|
|
-
|
2018-01-09 12:05:33 +01:00
|
|
|
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:
|
2018-01-10 08:47:00 +01:00
|
|
|
@@ -96,6 +103,9 @@ def _ssl_wrap_socket(sock, key_file, cer
|
|
|
|
context.load_verify_locations(ca_certs)
|
|
|
|
return context.wrap_socket(sock, server_hostname=hostname)
|
|
|
|
else:
|
|
|
|
+ if ssl_version is None:
|
|
|
|
+ ssl_version = ssl.PROTOCOL_SSLv23
|
|
|
|
+
|
|
|
|
return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
|
|
|
|
cert_reqs=cert_reqs, ca_certs=ca_certs,
|
|
|
|
ssl_version=ssl_version)
|
2018-01-09 12:05:33 +01:00
|
|
|
@@ -210,15 +220,8 @@ class NotRunningAppEngineEnvironment(Htt
|
2013-07-03 14:43:31 +02:00
|
|
|
# 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.
|
2014-03-05 22:24:40 +01:00
|
|
|
+CA_CERTS = None
|
2013-07-03 14:43:31 +02:00
|
|
|
|
|
|
|
# Which headers are hop-by-hop headers by default
|
|
|
|
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
|
2018-01-09 12:05:33 +01:00
|
|
|
@@ -975,8 +978,6 @@ class HTTPSConnectionWithTimeout(httplib
|
2016-03-15 21:06:26 +01:00
|
|
|
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
|
2018-01-09 12:05:33 +01:00
|
|
|
Index: httplib2-0.10.3/python3/httplib2/__init__.py
|
2016-03-15 21:06:26 +01:00
|
|
|
===================================================================
|
2018-01-09 12:05:33 +01:00
|
|
|
--- httplib2-0.10.3.orig/python3/httplib2/__init__.py
|
|
|
|
+++ httplib2-0.10.3/python3/httplib2/__init__.py
|
2016-03-15 21:06:26 +01:00
|
|
|
@@ -124,8 +124,7 @@ DEFAULT_MAX_REDIRECTS = 5
|
2013-07-03 14:43:31 +02:00
|
|
|
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")
|
2016-03-15 21:06:26 +01:00
|
|
|
+CA_CERTS = None
|
2013-07-03 14:43:31 +02:00
|
|
|
|
|
|
|
def _get_end2end_headers(response):
|
|
|
|
hopbyhop = list(HOP_BY_HOP)
|
2018-01-09 12:05:33 +01:00
|
|
|
@@ -838,16 +837,17 @@ class HTTPSConnectionWithTimeout(http.cl
|
2017-04-19 16:09:02 +02:00
|
|
|
# TODO: implement proxy_info
|
2016-03-15 21:06:26 +01:00
|
|
|
self.proxy_info = proxy_info
|
|
|
|
context = None
|
|
|
|
- if ca_certs is None:
|
|
|
|
- ca_certs = CA_CERTS
|
2017-04-19 16:09:02 +02:00
|
|
|
- if (cert_file or ca_certs):
|
|
|
|
+ if True:
|
2016-03-15 21:06:26 +01:00
|
|
|
if not hasattr(ssl, 'SSLContext'):
|
|
|
|
raise CertificateValidationUnsupportedInPython31()
|
|
|
|
- context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
2017-04-19 16:09:02 +02:00
|
|
|
- if disable_ssl_certificate_validation:
|
|
|
|
- context.verify_mode = ssl.CERT_NONE
|
|
|
|
- else:
|
|
|
|
- context.verify_mode = ssl.CERT_REQUIRED
|
2016-03-15 21:06:26 +01:00
|
|
|
+
|
|
|
|
+ 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:
|
2018-01-09 12:05:33 +01:00
|
|
|
Index: httplib2-0.10.3/setup.py
|
2016-03-15 21:06:26 +01:00
|
|
|
===================================================================
|
2018-01-09 12:05:33 +01:00
|
|
|
--- httplib2-0.10.3.orig/setup.py
|
|
|
|
+++ httplib2-0.10.3/setup.py
|
2016-03-15 21:06:26 +01:00
|
|
|
@@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``h
|
2013-07-03 14:43:31 +02:00
|
|
|
""",
|
|
|
|
package_dir=pkgdir,
|
|
|
|
packages=['httplib2'],
|
|
|
|
- package_data={'httplib2': ['*.txt']},
|
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 4 - Beta',
|
|
|
|
'Environment :: Web Environment',
|