Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of RETRIES parameter #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python2/httplib2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,14 +1291,14 @@ def _conn_request(self, conn, request_uri, method, body, headers):
# Just because the server closed the connection doesn't apparently mean
# that the server didn't send a response.
if hasattr(conn, 'sock') and conn.sock is None:
if i < RETRIES-1:
if i < RETRIES:
conn.close()
conn.connect()
continue
else:
conn.close()
raise
if i < RETRIES-1:
if i < RETRIES:
conn.close()
conn.connect()
continue
Expand All @@ -1318,7 +1318,7 @@ def _conn_request(self, conn, request_uri, method, body, headers):
conn.close()
raise
except (socket.error, httplib.HTTPException):
if i < RETRIES-1:
if i < RETRIES:
conn.close()
conn.connect()
continue
Expand Down
6 changes: 3 additions & 3 deletions python3/httplib2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,14 +998,14 @@ def _conn_request(self, conn, request_uri, method, body, headers):
raise
except http.client.HTTPException:
if conn.sock is None:
if i < RETRIES-1:
if i < RETRIES:
conn.close()
conn.connect()
continue
else:
conn.close()
raise
if i < RETRIES-1:
if i < RETRIES:
conn.close()
conn.connect()
continue
Expand All @@ -1031,7 +1031,7 @@ def _conn_request(self, conn, request_uri, method, body, headers):
raise
except (socket.error, http.client.HTTPException):
conn.close()
if i == 0:
if i < RETRIES:
conn.close()
conn.connect()
continue
Expand Down