[PATCH 2/2] Make HTTPS check work with mod_wsgi

Felix Kaechele heffer at fedoraproject.org
Fri Mar 22 23:09:16 UTC 2013


---
 koji/auth.py         | 3 +++
 www/kojiweb/index.py | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/koji/auth.py b/koji/auth.py
index e1a9c46..27a537d 100644
--- a/koji/auth.py
+++ b/koji/auth.py
@@ -372,6 +372,9 @@ class Session(object):
         if self.logged_in:
             raise koji.AuthError, "Already logged in"
 
+        if contect.environ.get('wsgi.url_scheme') == 'https':
+            context.environ['HTTPS'] = '1'
+
         if context.environ.get('HTTPS') not in ['on', '1']:
             raise koji.AuthError, 'cannot call sslLogin() via a non-https connection'
 
diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py
index 0505c9c..6533746 100644
--- a/www/kojiweb/index.py
+++ b/www/kojiweb/index.py
@@ -176,6 +176,10 @@ def _construct_url(environ, page):
     port = environ['SERVER_PORT']
     host = environ['SERVER_NAME']
     url_scheme = 'http'
+
+    if environ.get('wsgi.url_scheme') == 'https':
+        environ['HTTPS'] == '1'
+
     if environ.get('HTTPS') in ('on','yes','1'):
         url_scheme = 'https'
     if (url_scheme == 'https' and port == '443') or \
@@ -219,6 +223,9 @@ def login(environ, page=None):
     session = _getServer(environ)
     options = environ['koji.options']
 
+    if environ.get('wsgi.url_scheme') == 'https':
+        environ['HTTPS'] = '1'
+
     # try SSL first, fall back to Kerberos
     if options['WebCert']:
         if environ.get('HTTPS') not in ['on', 'yes', '1']:
-- 
1.8.1.4



More information about the buildsys mailing list