changeset 4872:419a6f715c6a

Use wsgi.url_scheme instead of ad-hoc CGI checks. Instead of each place in hgweb_mod that needs to check for SSL or get the protocol scheme (http vs. https) doing it ad-hoc, make them just look at the wsgi.url_scheme which because of previous patches is now always set correctly.
author Wesley J. Landaker <wjl@icecavern.net>
date Thu, 12 Jul 2007 22:55:44 -0700
parents d787d9ad67cc
children 28b23b9073a8
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Thu Jul 12 22:44:16 2007 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Jul 12 22:55:44 2007 -0700
@@ -787,7 +787,8 @@
             style = req.form['style'][0]
         mapfile = style_map(self.templatepath, style)
 
-        if req.env.get('HTTPS'):
+        proto = req.env.get('wsgi.url_scheme')
+        if proto == 'https':
             proto = 'https'
             default_port = "443"
         else:
@@ -1070,7 +1071,7 @@
         # replayed
         ssl_req = self.configbool('web', 'push_ssl', True)
         if ssl_req:
-            if not req.env.get('HTTPS'):
+            if req.env.get('wsgi.url_scheme') != 'https':
                 bail(_('ssl required\n'))
                 return
             proto = 'https'