summaryrefslogtreecommitdiff
path: root/python3/httplib2
diff options
context:
space:
mode:
authorJoe Gregorio <jcgregorio@google.com>2012-08-28 12:19:28 -0400
committerJoe Gregorio <jcgregorio@google.com>2012-08-28 12:19:28 -0400
commited72cba49248fa51f5787d4a2c19f36297a9ee5f (patch)
tree77b14c2d9f0eb3446f9f2018208012239e340fba /python3/httplib2
parent5a16772caf5ff75722794406143c24ced4e4164d (diff)
downloadhttplib2-ed72cba49248fa51f5787d4a2c19f36297a9ee5f.tar.gz
Fixes issue #212. Fixes issue #210. Fixes issue #214. Fixes issue #223. Fixes issue #222.
Diffstat (limited to 'python3/httplib2')
-rw-r--r--python3/httplib2/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
index 5608baa..0b2318b 100644
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -24,7 +24,7 @@ __contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)",
"Louis Nyffenegger",
"Mark Pilgrim"]
__license__ = "MIT"
-__version__ = "0.7.4"
+__version__ = "0.7.5"
import re
import sys
@@ -780,6 +780,10 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection):
check_hostname=True)
+SCHEME_TO_CONNECTION = {
+ 'http': HTTPConnectionWithTimeout,
+ 'https': HTTPSConnectionWithTimeout
+ }
class Http(object):
"""An HTTP client that handles:
@@ -934,7 +938,7 @@ and more.
else:
content = b""
if method == "HEAD":
- response.close()
+ conn.close()
else:
content = response.read()
response = Response(response)
@@ -1067,7 +1071,7 @@ a string that contains the response entity body.
conn = self.connections[conn_key]
else:
if not connection_type:
- connection_type = (scheme == 'https') and HTTPSConnectionWithTimeout or HTTPConnectionWithTimeout
+ connection_type = SCHEME_TO_CONNECTION[scheme]
certs = list(self.certificates.iter(authority))
if issubclass(connection_type, HTTPSConnectionWithTimeout):
if certs:
@@ -1107,7 +1111,7 @@ a string that contains the response entity body.
if v.startswith('=?') and v.endswith('?='):
info.replace_header(k,
str(*email.header.decode_header(v)[0]))
- except IndexError:
+ except (IndexError, ValueError):
self.cache.delete(cachekey)
cachekey = None
cached_value = None