summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2008-07-08 21:05:53 +0200
committerHelmut Grohne <helmut@subdivi.de>2008-07-08 21:05:53 +0200
commit642e578d59a877a277cffe797d82b0f32dcd6303 (patch)
treeb5e3fd0ad538526559abe3d6f21262fb0c919a88 /wsgitools
parentd709effdbaffe75ae40fdea4a71beb8ae700e95e (diff)
downloadwsgitools-642e578d59a877a277cffe797d82b0f32dcd6303.tar.gz
environ["wsgi.input"].read fixed in scgi.forkpool
Diffstat (limited to 'wsgitools')
-rw-r--r--wsgitools/scgi/forkpool.py30
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):
"""