Upstream update 0.7.2
This commit is contained in:
parent
5e8bb23ca0
commit
7dad936925
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
httplib2-0.4.0.tar.gz
|
||||
/httplib2-0.7.2.tar.gz
|
||||
|
@ -1,140 +0,0 @@
|
||||
Index: httplib2/__init__.py
|
||||
===================================================================
|
||||
--- httplib2/__init__.py (revision 274)
|
||||
+++ httplib2/__init__.py (working copy)
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
import re
|
||||
import sys
|
||||
-import md5
|
||||
import email
|
||||
import email.Utils
|
||||
import email.Message
|
||||
@@ -42,7 +41,14 @@
|
||||
import calendar
|
||||
import time
|
||||
import random
|
||||
-import sha
|
||||
+# remove depracated warning in python2.6
|
||||
+try:
|
||||
+ from hashlib import sha1 as _sha, md5 as _md5
|
||||
+except ImportError:
|
||||
+ import sha
|
||||
+ import md5
|
||||
+ _sha = sha.new
|
||||
+ _md5 = md5.new
|
||||
import hmac
|
||||
from gettext import gettext as _
|
||||
import socket
|
||||
@@ -52,12 +58,27 @@
|
||||
except ImportError:
|
||||
socks = None
|
||||
|
||||
+# Build the appropriate socket wrapper for ssl
|
||||
+try:
|
||||
+ import ssl # python 2.6
|
||||
+ _ssl_wrap_socket = ssl.wrap_socket
|
||||
+except ImportError:
|
||||
+ def _ssl_wrap_socket(sock, key_file, cert_file):
|
||||
+ ssl_sock = socket.ssl(sock, key_file, cert_file)
|
||||
+ return httplib.FakeSocket(sock, ssl_sock)
|
||||
+
|
||||
+
|
||||
if sys.version_info >= (2,3):
|
||||
from iri2uri import iri2uri
|
||||
else:
|
||||
def iri2uri(uri):
|
||||
return uri
|
||||
|
||||
+def has_timeout(timeout): # python 2.6
|
||||
+ if hasattr(socket, '_GLOBAL_DEFAULT_TIMEOUT'):
|
||||
+ return (timeout is not None and timeout is not socket._GLOBAL_DEFAULT_TIMEOUT)
|
||||
+ return (timeout is not None)
|
||||
+
|
||||
__all__ = ['Http', 'Response', 'ProxyInfo', 'HttpLib2Error',
|
||||
'RedirectMissingLocation', 'RedirectLimit', 'FailedToDecompressContent',
|
||||
'UnimplementedDigestAuthOptionError', 'UnimplementedHmacDigestAuthOptionError',
|
||||
@@ -182,7 +203,7 @@
|
||||
pass
|
||||
if isinstance(filename,unicode):
|
||||
filename=filename.encode('utf-8')
|
||||
- filemd5 = md5.new(filename).hexdigest()
|
||||
+ filemd5 = _md5(filename).hexdigest()
|
||||
filename = re_url_scheme.sub("", filename)
|
||||
filename = re_slash.sub(",", filename)
|
||||
|
||||
@@ -363,11 +384,11 @@
|
||||
cache.set(cachekey, text)
|
||||
|
||||
def _cnonce():
|
||||
- dig = md5.new("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest()
|
||||
+ dig = _md5("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest()
|
||||
return dig[:16]
|
||||
|
||||
def _wsse_username_token(cnonce, iso_now, password):
|
||||
- return base64.encodestring(sha.new("%s%s%s" % (cnonce, iso_now, password)).digest()).strip()
|
||||
+ return base64.encodestring(_sha("%s%s%s" % (cnonce, iso_now, password)).digest()).strip()
|
||||
|
||||
|
||||
# For credentials we need two things, first
|
||||
@@ -441,7 +462,7 @@
|
||||
|
||||
def request(self, method, request_uri, headers, content, cnonce = None):
|
||||
"""Modify the request headers"""
|
||||
- H = lambda x: md5.new(x).hexdigest()
|
||||
+ H = lambda x: _md5(x).hexdigest()
|
||||
KD = lambda s, d: H("%s:%s" % (s, d))
|
||||
A2 = "".join([method, ":", request_uri])
|
||||
self.challenge['cnonce'] = cnonce or _cnonce()
|
||||
@@ -501,13 +522,13 @@
|
||||
if self.challenge['pw-algorithm'] not in ['SHA-1', 'MD5']:
|
||||
raise UnimplementedHmacDigestAuthOptionError( _("Unsupported value for pw-algorithm: %s." % self.challenge['pw-algorithm']))
|
||||
if self.challenge['algorithm'] == 'HMAC-MD5':
|
||||
- self.hashmod = md5
|
||||
+ self.hashmod = _md5
|
||||
else:
|
||||
- self.hashmod = sha
|
||||
+ self.hashmod = _sha
|
||||
if self.challenge['pw-algorithm'] == 'MD5':
|
||||
- self.pwhashmod = md5
|
||||
+ self.pwhashmod = _md5
|
||||
else:
|
||||
- self.pwhashmod = sha
|
||||
+ self.pwhashmod = _sha
|
||||
self.key = "".join([self.credentials[0], ":",
|
||||
self.pwhashmod.new("".join([self.credentials[1], self.challenge['salt']])).hexdigest().lower(),
|
||||
":", self.challenge['realm']
|
||||
@@ -604,9 +625,6 @@
|
||||
|
||||
AUTH_SCHEME_ORDER = ["hmacdigest", "googlelogin", "digest", "wsse", "basic"]
|
||||
|
||||
-def _md5(s):
|
||||
- return
|
||||
-
|
||||
class FileCache(object):
|
||||
"""Uses a local directory as a store for cached files.
|
||||
Not really safe to use if multiple threads or processes are going to
|
||||
@@ -701,7 +719,7 @@
|
||||
else:
|
||||
self.sock = socket.socket(af, socktype, proto)
|
||||
# Different from httplib: support timeouts.
|
||||
- if self.timeout is not None:
|
||||
+ if has_timeout(self.timeout):
|
||||
self.sock.settimeout(self.timeout)
|
||||
# End of difference from httplib.
|
||||
if self.debuglevel > 0:
|
||||
@@ -737,11 +755,11 @@
|
||||
sock.setproxy(*self.proxy_info.astuple())
|
||||
else:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
- if self.timeout is not None:
|
||||
+
|
||||
+ if has_timeout(self.timeout):
|
||||
sock.settimeout(self.timeout)
|
||||
sock.connect((self.host, self.port))
|
||||
- ssl = socket.ssl(sock, self.key_file, self.cert_file)
|
||||
- self.sock = httplib.FakeSocket(sock, ssl)
|
||||
+ self.sock =_ssl_wrap_socket(sock, self.key_file, self.cert_file)
|
||||
|
||||
|
||||
|
16
python-httplib2.certfile.patch
Normal file
16
python-httplib2.certfile.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff -up ./python2/httplib2/__init__.py.orig ./python2/httplib2/__init__.py
|
||||
--- ./python2/httplib2/__init__.py.orig 2012-02-24 14:07:01.232200397 +1000
|
||||
+++ ./python2/httplib2/__init__.py 2012-02-24 14:13:51.290447860 +1000
|
||||
@@ -177,8 +177,10 @@ class CertificateHostnameMismatch(SSLHan
|
||||
DEFAULT_MAX_REDIRECTS = 5
|
||||
|
||||
# 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")
|
||||
+# We use fedora ca bundle file instead, to preserve backward compability.
|
||||
+CA_CERTS = "/etc/ssl/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']
|
@ -1,14 +1,15 @@
|
||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
Name: python-httplib2
|
||||
Version: 0.4.0
|
||||
Release: 5%{?dist}
|
||||
Version: 0.7.2
|
||||
Release: 1%{?dist}
|
||||
Summary: A comprehensive HTTP client library
|
||||
|
||||
Group: System Environment/Libraries
|
||||
License: MIT
|
||||
URL: http://code.google.com/p/httplib2/
|
||||
Source0: http://httplib2.googlecode.com/files/httplib2-0.4.0.tar.gz
|
||||
Patch0: httplib_py26.diff
|
||||
Source0: http://httplib2.googlecode.com/files/httplib2-%{version}.tar.gz
|
||||
#Patch0: httplib_py26.diff
|
||||
Patch1: python-httplib2.certfile.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: python-setuptools-devel
|
||||
@ -21,7 +22,8 @@ other HTTP libraries.
|
||||
|
||||
%prep
|
||||
%setup -q -n httplib2-%{version}
|
||||
%patch0 -p0 -b .issue39
|
||||
#%patch0 -p0 -b .issue39
|
||||
%patch1 -p0 -b .certfile
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" python setup.py build
|
||||
@ -36,14 +38,38 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README PKG-INFO
|
||||
%doc README
|
||||
%{python_sitelib}/*
|
||||
|
||||
%changelog
|
||||
* Fri Feb 24 2012 Ding-Yi Chen <dchen at redhat.com> - 0.7.2-1
|
||||
- Upstream update to 0.7.2
|
||||
Which may fixed http://code.google.com/p/httplib2/issues/detail?id=62
|
||||
Note this version uses fedora's cert file bundle instead of httplib2
|
||||
default.
|
||||
|
||||
* Fri Jul 29 2011 Ding-Yi Chen <dchen at redhat.com> - 0.4.0-5
|
||||
- Apply that address python-httplib2 (GoogleCode Hosted) issue 39
|
||||
http://code.google.com/p/httplib2/issues/detail?id=39
|
||||
|
||||
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
|
||||
|
||||
* Wed Aug 25 2010 Thomas Spura <tomspur@fedoraproject.org> - 0.6.0-4
|
||||
- rebuild with python3.2
|
||||
http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html
|
||||
|
||||
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
|
||||
|
||||
* Tue Apr 20 2010 Tom "spot" Callaway <tcallawa@redhat.com>
|
||||
- minor spec cleanups
|
||||
- enable python3 support
|
||||
|
||||
* Fri Apr 02 2010 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
|
||||
- 0.6.0-1
|
||||
- version upgrade (#566721)
|
||||
|
||||
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user