Fixed bug handling a broken cached value.
diff --git a/httplib2/__init__.py b/httplib2/__init__.py
index a3ac4bf..8a55408 100644
--- a/httplib2/__init__.py
+++ b/httplib2/__init__.py
@@ -717,6 +717,7 @@
except:
self.cache.delete(cachekey)
cachekey = None
+ cached_value = None
else:
cachekey = None
@@ -728,7 +729,7 @@
# RFC 2616 Section 13.10
self.cache.delete(cachekey)
- if method in ["GET", "HEAD"] and self.cache and 'range' not in headers:
+ if cached_value and method in ["GET", "HEAD"] and self.cache and 'range' not in headers:
if info.has_key('-x-permanent-redirect-url'):
# Should cached permanent redirects be counted in our redirection count? For now, yes.
(response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)