Skip to content

Commit

Permalink
fix hanging on chunked encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jun 10, 2012
1 parent fe5ac05 commit be779cb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/disco/comm.py
Expand Up @@ -161,6 +161,8 @@ def __iter__(self):
def __len__(self):
if 'content-range' in self.headers:
return int(self.headers['content-range'].split('/')[1])
elif self.headers.get('transfer-encoding') == 'chunked':
return len(self.buf)
return int(self.headers.get('content-length', 0))

def close(self):
Expand Down

0 comments on commit be779cb

Please sign in to comment.