strip out buggy retry code

it assumed there'd be at least one retry, and was trying to return
response that was initialized
This commit is contained in:
Damien Elmes 2013-11-08 01:14:49 +09:00
parent be81d282ac
commit 3dbc6fa0dd

View file

@ -449,7 +449,6 @@ httplib.HTTPConnection.send = _incrementalSend
# receiving in httplib2
def _conn_request(self, conn, request_uri, method, body, headers):
for i in range(httplib2.RETRIES):
try:
if conn.sock is None:
conn.connect()
@ -475,26 +474,11 @@ 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 conn.sock is None:
if i == 0:
conn.close()
conn.connect()
continue
else:
conn.close()
raise
if i == 0:
conn.close()
conn.connect()
continue
pass
try:
response = conn.getresponse()
except (socket.error, httplib.HTTPException):
if i == 0:
conn.close()
conn.connect()
continue
else:
raise
else:
content = ""
@ -512,7 +496,6 @@ def _conn_request(self, conn, request_uri, method, body, headers):
response = httplib2.Response(response)
if method != "HEAD":
content = httplib2._decompressContent(response, content)
break
return (response, content)
httplib2.Http._conn_request = _conn_request