Handle CGI SSL detection via HTTPS environment better.
authorWesley J. Landaker <wjl@icecavern.net>
Thu, 12 Jul 2007 13:55:20 -0600
changeset 4869 be591b740e0f
parent 4868 192cd95c2ba8
child 4870 8f430b1b3025
Handle CGI SSL detection via HTTPS environment better. Some servers send on/off, 0/1, yes/no, and may be upper or lower case. This fix will handle all of those permutations. It was inspired by the detection done in in some other wsgi python web applications I looked at.
mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py	Wed Jul 11 20:15:03 2007 -0300
+++ b/mercurial/hgweb/wsgicgi.py	Thu Jul 12 13:55:20 2007 -0600
@@ -23,7 +23,7 @@
     environ['wsgi.multiprocess'] = True
     environ['wsgi.run_once'] = True
 
-    if environ.get('HTTPS','off') in ('on','1'):
+    if environ.get('HTTPS','off').lower() in ('on','1','yes'):
         environ['wsgi.url_scheme'] = 'https'
     else:
         environ['wsgi.url_scheme'] = 'http'