--- /dev/null
+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,
--- /dev/null
+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)
--- /dev/null
+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@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.
--- /dev/null
+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@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']
+
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
BuildRequires: python3-modules
%endif
BuildRequires: rpm-pythonprov
+Requires: ca-certificates
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%prep
%setup -q -n httplib2-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
%py_build
%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}
%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