diff options
author | Helmut Grohne <helmut@subdivi.de> | 2007-04-16 18:01:33 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2007-04-16 18:01:33 +0200 |
commit | 179420b66aa54a676dbd5ce77dff28688d6a9d1d (patch) | |
tree | 9f5eea0769f7c3c8619600226d07d118d08684b8 | |
parent | 1e92fd7f7d83fb3b73fa813e6caf7c02bb079020 (diff) | |
download | wsgitools-179420b66aa54a676dbd5ce77dff28688d6a9d1d.tar.gz |
delay sending headers in scgi server when possible
-rw-r--r-- | wsgitools/scgi.py | 7 |
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"): |