]> granicus.if.org Git - python/commitdiff
Simplify code in HTTPResponse.read()
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Feb 2013 22:08:51 +0000 (23:08 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Feb 2013 22:08:51 +0000 (23:08 +0100)
Lib/http/client.py

index 36528dacba7abad17b35315b71d5d3b8ff3f988f..4574eedaf2a8e1adfa8be2fda0fa7e773b65b006 100644 (file)
@@ -515,13 +515,10 @@ class HTTPResponse(io.RawIOBase):
             # 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