From 64d4a8afaf583993f54ed5688ef39ecc7d35b48e Mon Sep 17 00:00:00 2001 From: Vytis Banaitis Date: Thu, 17 Sep 2015 17:03:28 +0300 Subject: [PATCH] Fix handling of RETRIES parameter. --- python2/httplib2/__init__.py | 6 +++--- python3/httplib2/__init__.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) 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