summaryrefslogtreecommitdiff
path: root/wsgitools/scgi/asynchronous.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/scgi/asynchronous.py')
-rw-r--r--wsgitools/scgi/asynchronous.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py
index 6b69c73..4ecb00a 100644
--- a/wsgitools/scgi/asynchronous.py
+++ b/wsgitools/scgi/asynchronous.py
@@ -11,6 +11,8 @@ except ImportError:
import StringIO as io
import errno
+from wsgitools.scgi import _convert_environ
+
if sys.version_info[0] >= 3:
def exc_info_for_raise(exc_info):
return exc_info[0](exc_info[1]).with_traceback(exc_info[2])
@@ -44,15 +46,6 @@ class SCGIConnection(asyncore.dispatcher):
# () -> unset, (..,..) -> set, True -> sent
self.body = io.StringIO() # request body
- def _wsgi_headers(self):
- return {"wsgi.version": (1, 0),
- "wsgi.input": self.body,
- "wsgi.errors": self.server.error,
- "wsgi.url_scheme": "http",
- "wsgi.multithread": False,
- "wsgi.multiprocess": False,
- "wsgi.run_once": False}
-
def _try_send_headers(self):
if self.outheaders != True:
assert not self.outbuff
@@ -128,14 +121,9 @@ class SCGIConnection(asyncore.dispatcher):
self.body.seek(0)
self.inbuff = ""
self.reqlen = 0
- self.environ.update(self._wsgi_headers())
- if self.environ.get("HTTPS", "no").lower() in ('yes', 'y', '1'):
- self.environ["wsgi.url_scheme"] = "https"
- if "HTTP_CONTENT_TYPE" in self.environ:
- self.environ["CONTENT_TYPE"] = \
- self.environ.pop("HTTP_CONTENT_TYPE")
- if "HTTP_CONTENT_LENGTH" in self.environ:
- del self.environ["HTTP_CONTENT_LENGTH"] # TODO: better way?
+ _convert_environ(self.environ)
+ self.environ["wsgi.input"] = self.body
+ self.environ["wsgi.errors"] = self.server.error
self.wsgihandler = iter(self.server.wsgiapp(
self.environ, self.start_response))
self.state = SCGIConnection.REQ