Commit 79182cc6 authored by Sam Rushing's avatar Sam Rushing

http_file.read(): implement size argument

parent 69e7997d
......@@ -89,15 +89,18 @@ class http_file:
else:
yield block
# XXX implement <size> argument
def read (self, join=True):
"read the entire contents. join=False returns a generator, join=True returns a string."
r = (x for x in self.streamo.read_all())
if join:
return ''.join (r)
def read (self, size=0, join=True):
"read from the file. join=False returns a generator, join=True returns a string."
if size == 0:
r = (x for x in self.streamo.read_all())
if join:
return ''.join (r)
else:
return r
else:
return r
# ignore join argument
return self.streamo.read_exact (size)
def readline (self):
"read a newline-delimited line."
if self.done_cv.done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment