Skip to content

Commit

Permalink
add support for read() (without arguments) to comm_curl
Browse files Browse the repository at this point in the history
  • Loading branch information
Ville Tuulos committed Feb 8, 2010
1 parent 732119f commit 4b31f71
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pydisco/disco/comm_curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,15 @@ def write(self, buf):
self.body = True
self.buf += buf

def read(self, bytes):
while len(self.buf) < bytes and self.cont:
self.perform()
def read(self, bytes = None):
if bytes == None:
while self.cont:
self.perform()
bytes = len(self.buf)
else:
while len(self.buf) < bytes and self.cont:
self.perform()

r = self.buf[:bytes]
self.buf = self.buf[bytes:]
return r
Expand Down

0 comments on commit 4b31f71

Please sign in to comment.