From dfac4c7ad90ccf11d629ee19be01b7999d4ae107 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 25 Apr 2007 14:24:13 +0200 Subject: some environ fixups in scgi.* --- wsgitools/scgi/asynchronous.py | 4 +++- wsgitools/scgi/forkpool.py | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'wsgitools/scgi') diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py index ff226de..f5a6a43 100644 --- a/wsgitools/scgi/asynchronous.py +++ b/wsgitools/scgi/asynchronous.py @@ -39,7 +39,7 @@ class SCGIConnection(asyncore.dispatcher): return {"wsgi.version": (1, 0), "wsgi.input": self.body, "wsgi.errors": self.server.error, - "wsgi.url_scheme": "http", # TODO: this is wrong + "wsgi.url_scheme": "http", "wsgi.multithread": False, "wsgi.multiprocess": False, "wsgi.run_once": False} @@ -116,6 +116,8 @@ class SCGIConnection(asyncore.dispatcher): 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") diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py index 6476458..157e320 100644 --- a/wsgitools/scgi/forkpool.py +++ b/wsgitools/scgi/forkpool.py @@ -214,10 +214,16 @@ class SCGIServer: "wsgi.version": (1, 0), "wsgi.input": SocketFileWrapper(con), "wsgi.errors": self.error, - "wsgi.url_scheme": "http", # TODO: this is wrong + "wsgi.url_scheme": "http", "wsgi.multithread": False, "wsgi.multiprocess": True, "wsgi.run_once": False}) + if environ.get("HTTPS", "no").lower() in ('yes', 'y', '1'): + environ["wsgi.url_scheme"] = "https" + if "HTTP_CONTENT_TYPE" in environ: + environ["CONTENT_TYPE"] = environ.pop("HTTP_CONTENT_TYPE") + if "HTTP_CONTENT_LENGTH" in environ: + del environ["HTTP_CONTENT_LENGTH"] # TODO: better way? result = self.wsgiapp(environ, start_response) assert hasattr(result, "__iter__") -- cgit v1.2.3