diff options
author | Helmut Grohne <helmut@subdivi.de> | 2008-07-08 21:05:53 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2008-07-08 21:05:53 +0200 |
commit | 642e578d59a877a277cffe797d82b0f32dcd6303 (patch) | |
tree | b5e3fd0ad538526559abe3d6f21262fb0c919a88 /wsgitools/scgi/forkpool.py | |
parent | d709effdbaffe75ae40fdea4a71beb8ae700e95e (diff) | |
download | wsgitools-642e578d59a877a277cffe797d82b0f32dcd6303.tar.gz |
environ["wsgi.input"].read fixed in scgi.forkpool
Diffstat (limited to 'wsgitools/scgi/forkpool.py')
-rw-r--r-- | wsgitools/scgi/forkpool.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 055dbd1..56f1787 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -56,25 +56,27 @@ class SocketFileWrapper: @raise: socket.error """ if size is None: + retl = [] + data = self.buff + self.buff = "" + while data: + retl.append(data) + try: + data = self._recv() + except socket.error: + break + return "".join(retl) + while len(self.buff) < size: try: - data = self._recv() + data = self._recv(min(4096, size - len(self.buff))) except socket.error: - if self.buff: - ret, self.buff = self.buff, "" - return ret - raise - return self.buff + data + break + self.buff += data if size <= len(self.buff): ret, self.buff = self.buff[:size], self.buff[size:] return ret - try: - data = self._recv(size - len(self.buff)) - except socket.error: - if self.buff: - ret, self.buff = self.buff, "" - return self.buff - raise - return self.buff + data + ret, self.buff = self.buff, "" + return ret def readline(self, size=None): """ |