Fix SSL requests with Transfer-Encoding: chunked

Add size parameter to FileLike.readline, used by read_chunked.
This commit is contained in:
Michael Frister 2012-03-08 23:10:21 +01:00
parent e67dbf6123
commit 23f7214fc3

View File

@ -184,10 +184,14 @@ class FileLike:
result += data result += data
return result return result
def readline(self): def readline(self, size = None):
result = '' result = ''
bytes_read = 0
while True: while True:
if size is not None and bytes_read >= size:
break
ch = self.read(1) ch = self.read(1)
bytes_read += 1
if not ch: if not ch:
break break
else: else: