diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py index 19e7cff..62cb305 100644 --- a/python2/httplib2/__init__.py +++ b/python2/httplib2/__init__.py @@ -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 @@ -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 diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py index 260fa6b..c2b8816 100644 --- a/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py @@ -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 @@ -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