Fixes issue 98.
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
index 2bcdc53..0e7184f 100644
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -992,7 +992,7 @@
(response, content) = self.request(location, redirect_method, body=body, headers = headers, redirections = redirections - 1)
response.previous = old_response
else:
- raise RedirectLimit( _("Redirected more times than rediection_limit allows."), response, content)
+ raise RedirectLimit("Redirected more times than redirection_limit allows.", response, content)
elif response.status in [200, 203] and method == "GET":
# Don't cache 206's since we aren't going to handle byte range requests
if 'content-location' not in response:
@@ -1112,6 +1112,8 @@
if cached_value and method in ["GET", "HEAD"] and self.cache and 'range' not in headers:
if '-x-permanent-redirect-url' in info:
# Should cached permanent redirects be counted in our redirection count? For now, yes.
+ if redirections <= 0:
+ raise RedirectLimit("Redirected more times than redirection_limit allows.", {}, "")
(response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)
response.previous = Response(info)
response.previous.fromcache = True
diff --git a/python3/httplib2test.py b/python3/httplib2test.py
index f622a30..8cd6809 100755
--- a/python3/httplib2test.py
+++ b/python3/httplib2test.py
@@ -395,7 +395,7 @@
self.fail("Threw wrong kind of exception ")
# Re-run the test with out the exceptions
- self.http.force_exception_to_status_code = True
+ self.http.force_exception_to_status_code = True
(response, content) = self.http.request(uri, "GET", redirections = 1)
self.assertEqual(response.status, 500)