[packages/python-httplib2] - up to 0.10.3; use system ca-bundle; patches from FC
arekm
arekm at pld-linux.org
Tue Feb 27 10:47:15 CET 2018
commit 5007a437a37903e273b183f7dc7e0bf98453f56a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Tue Feb 27 10:47:08 2018 +0100
- up to 0.10.3; use system ca-bundle; patches from FC
python-httplib2-0.9-proxy-http.patch | 16 ++++++++++++++++
python-httplib2.certfile.patch | 31 +++++++++++++++++++++++++++++++
python-httplib2.getCertHost.patch | 21 +++++++++++++++++++++
python-httplib2.rfc2459.patch | 19 +++++++++++++++++++
python-httplib2.spec | 25 +++++++++++++++++++------
5 files changed, 106 insertions(+), 6 deletions(-)
---
diff --git a/python-httplib2.spec b/python-httplib2.spec
index be0ba86..9f13d97 100644
--- a/python-httplib2.spec
+++ b/python-httplib2.spec
@@ -5,13 +5,17 @@
Summary: A comprehensive HTTP client library
Summary(pl.UTF-8): Obszerna biblioteka klienta HTTP
Name: python-httplib2
-Version: 0.8
-Release: 6
+Version: 0.10.3
+Release: 1
License: MIT
Group: Development/Languages/Python
-Source0: http://httplib2.googlecode.com/files/httplib2-%{version}.zip
-# Source0-md5: 0803da81fe1bb92f864715665defe65f
-URL: http://bitworking.org/projects/httplib2/
+Source0: https://github.com/httplib2/httplib2/archive/v%{version}.tar.gz
+# Source0-md5: 1be116cd19035de6de0de0f3027c643d
+Patch0: %{name}.certfile.patch
+Patch1: %{name}.getCertHost.patch
+Patch2: %{name}.rfc2459.patch
+Patch3: %{name}-0.9-proxy-http.patch
+URL: https://github.com/httplib2/httplib2
BuildRequires: python >= 2.3
BuildRequires: python-modules
BuildRequires: rpmbuild(macros) >= 1.710
@@ -22,6 +26,7 @@ BuildRequires: python3-distribute
BuildRequires: python3-modules
%endif
BuildRequires: rpm-pythonprov
+Requires: ca-certificates
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -84,6 +89,10 @@ cech pomijanych przez inne biblioteki. Obsługuje:
%prep
%setup -q -n httplib2-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%py_build
@@ -95,9 +104,11 @@ cech pomijanych przez inne biblioteki. Obsługuje:
%install
rm -rf $RPM_BUILD_ROOT
%py_install
+rm $RPM_BUILD_ROOT%{py_sitescriptdir}/httplib2/cacerts.txt
%if %{with python3}
%py3_install
+rm $RPM_BUILD_ROOT%{py3_sitescriptdir}/httplib2/cacerts.txt
%endif
%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
@@ -108,12 +119,14 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc README CHANGELOG
+%doc README.md CHANGELOG
%{py_sitescriptdir}/httplib2
%{py_sitescriptdir}/httplib2-%{version}-py*.egg-info
+%if %{with python3}
%files -n python3-httplib2
%defattr(644,root,root,755)
%doc python3/README CHANGELOG
%{py3_sitescriptdir}/httplib2
%{py3_sitescriptdir}/httplib2-%{version}-py*.egg-info
+%endif
diff --git a/python-httplib2-0.9-proxy-http.patch b/python-httplib2-0.9-proxy-http.patch
new file mode 100644
index 0000000..0d55002
--- /dev/null
+++ b/python-httplib2-0.9-proxy-http.patch
@@ -0,0 +1,16 @@
+diff -Nur httplib2-0.9.orig/python2/httplib2/__init__.py httplib2-0.9/python2/httplib2/__init__.py
+--- httplib2-0.9.orig/python2/httplib2/__init__.py 2015-04-03 12:56:04.834370332 -0600
++++ httplib2-0.9/python2/httplib2/__init__.py 2015-04-03 12:58:16.441925454 -0600
+@@ -838,7 +838,11 @@
+ else:
+ port = dict(https=443, http=80)[method]
+
+- proxy_type = 3 # socks.PROXY_TYPE_HTTP
++ if method == 'http':
++ proxy_type = 4 # socks.PROXY_TYPE_HTTP_NO_TUNNEL
++ else:
++ proxy_type = 3 # socks.PROXY_TYPE_HTTP
++
+ return ProxyInfo(
+ proxy_type = proxy_type,
+ proxy_host = host,
diff --git a/python-httplib2.certfile.patch b/python-httplib2.certfile.patch
new file mode 100644
index 0000000..e351169
--- /dev/null
+++ b/python-httplib2.certfile.patch
@@ -0,0 +1,31 @@
+diff -Nur httplib2-0.9.orig/python2/httplib2/__init__.py httplib2-0.9/python2/httplib2/__init__.py
+--- httplib2-0.9.orig/python2/httplib2/__init__.py 2014-04-14 06:52:57.000000000 -0600
++++ httplib2-0.9/python2/httplib2/__init__.py 2014-05-23 21:17:02.082118837 -0600
+@@ -191,8 +191,10 @@
+ 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")
++# CA_CERTS = os.path.join(
++# os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
++# Use Fedora system-wide shared certificate store for security, consistency.
++ CA_CERTS = "/etc/pki/tls/certs/ca-bundle.crt"
+
+ # Which headers are hop-by-hop headers by default
+ HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
+--- httplib2-0.9/python3/httplib2/__init__.py 2014-04-14 05:52:57.000000000 -0700
++++ httplib2-0.9/python3/httplib2/__init__.py.new 2015-01-12 17:22:19.815505848 -0800
+@@ -124,8 +124,10 @@
+ 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 = os.path.join(
++# os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
++# Use Fedora system-wide shared certificate store for security, consistency.
++CA_CERTS = "/etc/pki/tls/certs/ca-bundle.crt"
+
+ def _get_end2end_headers(response):
+ hopbyhop = list(HOP_BY_HOP)
diff --git a/python-httplib2.getCertHost.patch b/python-httplib2.getCertHost.patch
new file mode 100644
index 0000000..f9c53de
--- /dev/null
+++ b/python-httplib2.getCertHost.patch
@@ -0,0 +1,21 @@
+diff -up ./python2/httplib2/__init__.py.getCertHost ./python2/httplib2/__init__.py
+--- ./python2/httplib2/__init__.py.getCertHost 2012-05-03 17:16:33.834155219 +1000
++++ ./python2/httplib2/__init__.py 2012-06-21 18:19:33.804660257 +1000
+@@ -942,11 +942,12 @@ class HTTPSConnectionWithTimeout(httplib
+ list: A list of valid host globs.
+ """
+ if 'subjectAltName' in cert:
+- return [x[1] for x in cert['subjectAltName']
+- if x[0].lower() == 'dns']
+- else:
+- return [x[0][1] for x in cert['subject']
+- if x[0][0].lower() == 'commonname']
++ # Patch from richardfearn at gmail.com
++ return [x[1] for x in cert['subjectAltName']
++ if x[0].lower() == "dns"]
++
++ return [x[0][1] for x in cert['subject']
++ if x[0][0].lower() == 'commonname']
+
+ def _ValidateCertificateHostname(self, cert, hostname):
+ """Validates that a given hostname is valid for an SSL certificate.
diff --git a/python-httplib2.rfc2459.patch b/python-httplib2.rfc2459.patch
new file mode 100644
index 0000000..523129e
--- /dev/null
+++ b/python-httplib2.rfc2459.patch
@@ -0,0 +1,19 @@
+diff -up ./python2/httplib2/__init__.py.orig ./python2/httplib2/__init__.py
+--- ./python2/httplib2/__init__.py.orig 2012-07-27 18:35:59.215300471 +1000
++++ ./python2/httplib2/__init__.py 2012-07-27 18:36:30.697287505 +1000
+@@ -943,8 +943,13 @@ class HTTPSConnectionWithTimeout(httplib
+ """
+ if 'subjectAltName' in cert:
+ # Patch from richardfearn at gmail.com
+- return [x[1] for x in cert['subjectAltName']
++ # RFC 2459 states that subjectAltName may contain:
++ # either DNS, email, IP or URI
++ # email, URI,
++ hosts=[x[1] for x in cert['subjectAltName']
+ if x[0].lower() == "dns"]
++ if hosts:
++ return hosts
+
+ return [x[0][1] for x in cert['subject']
+ if x[0][0].lower() == 'commonname']
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-httplib2.git/commitdiff/5007a437a37903e273b183f7dc7e0bf98453f56a
More information about the pld-cvs-commit
mailing list