diff options
Diffstat (limited to 'wsgitools/scgi/forkpool.py')
-rw-r--r-- | wsgitools/scgi/forkpool.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 3597f08..107b31a 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -66,12 +66,19 @@ class SocketFileWrapper: except socket.error: break return "".join(retl) - while len(self.buff) < size: + datalist = [self.buff] + datalen = len(self.buff) + while datalen < size: try: - data = self._recv(min(4096, size - len(self.buff))) + data = self._recv(min(4096, size - datalen)) except socket.error: break - self.buff += data + if not data: + break + datalist.append(data) + datalen += len(data) + self.buff = "".join(datalist) + if size <= len(self.buff): ret, self.buff = self.buff[:size], self.buff[size:] return ret |