mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
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:
parent
be81d282ac
commit
3dbc6fa0dd
1 changed files with 46 additions and 63 deletions
17
aqt/sync.py
17
aqt/sync.py
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue