Simplify code in HTTPResponse.read()

This commit is contained in:
Antoine Pitrou 2013-02-02 23:08:51 +01:00
parent beec61ae4e
commit de59565f29
1 changed files with 1 additions and 4 deletions

View File

@ -515,13 +515,10 @@ def read(self, amt=None):
# Ideally, we would raise IncompleteRead if the content-length
# wasn't satisfied, but it might break compatibility.
self.close()
if self.length is not None:
elif self.length is not None:
self.length -= len(s)
if not self.length:
self.close()
else:
if not s:
self.close()
return s