summaryrefslogtreecommitdiff
path: root/wsgitools
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2007-04-16 18:01:33 +0200
committerHelmut Grohne <helmut@subdivi.de>2007-04-16 18:01:33 +0200
commit179420b66aa54a676dbd5ce77dff28688d6a9d1d (patch)
tree9f5eea0769f7c3c8619600226d07d118d08684b8 /wsgitools
parent1e92fd7f7d83fb3b73fa813e6caf7c02bb079020 (diff)
downloadwsgitools-179420b66aa54a676dbd5ce77dff28688d6a9d1d.tar.gz
delay sending headers in scgi server when possible
Diffstat (limited to 'wsgitools')
-rw-r--r--wsgitools/scgi.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/wsgitools/scgi.py b/wsgitools/scgi.py
index c12a296..51349a0 100644
--- a/wsgitools/scgi.py
+++ b/wsgitools/scgi.py
@@ -54,8 +54,9 @@ class SCGIConnection(asyncore.dispatcher):
def _wsgi_write(self, data):
assert self.state >= SCGIConnection.REQ
- self._try_send_headers()
- self.outbuff += data
+ if data:
+ self._try_send_headers()
+ self.outbuff += data
def readable(self):
"""asyncore interface"""
@@ -144,9 +145,9 @@ class SCGIConnection(asyncore.dispatcher):
assert self.state >= SCGIConnection.REQ
if len(self.outbuff) < self.BLOCK_SIZE:
for data in self.wsgihandler:
- self._try_send_headers()
self.outbuff += data
if len(self.outbuff) >= self.BLOCK_SIZE:
+ self._try_send_headers()
break
if len(self.outbuff) == 0:
if hasattr(self.wsgihandler, "close"):