community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1867169 - /comdev/reporter.apache.org/trunk/scripts/wsgi.py
Date Thu, 19 Sep 2019 10:31:45 GMT
Author: sebb
Date: Thu Sep 19 10:31:45 2019
New Revision: 1867169

URL: http://svn.apache.org/viewvc?rev=1867169&view=rev
Log:
Only extract user id if it will be used

Modified:
    comdev/reporter.apache.org/trunk/scripts/wsgi.py

Modified: comdev/reporter.apache.org/trunk/scripts/wsgi.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/wsgi.py?rev=1867169&r1=1867168&r2=1867169&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/wsgi.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/wsgi.py Thu Sep 19 10:31:45 2019
@@ -25,14 +25,14 @@ webmap = {
 
 def app(environ, start_fn):
     now = time.time()
-    bauth = re.match(r"Basic (.+)", environ.get('HTTP_AUTHORIZATION', 'foo'))
-    if bauth:
-        bdec = base64.b64decode(bauth.group(1)).decode('utf-8')
-        m = re.match("^(.+?):(.+)$", bdec)
-        if m:
-            user = m.group(1)
     uri = environ.get('PATH_INFO', '/')
     if uri in webmap:
+        bauth = re.match(r"Basic (.+)", environ.get('HTTP_AUTHORIZATION', 'foo'))
+        if bauth:
+            bdec = base64.b64decode(bauth.group(1)).decode('utf-8')
+            m = re.match("^(.+?):(.+)$", bdec)
+            if m:
+                user = m.group(1)
         output = webmap[uri](environ, user)
     else:
         output = {'okay': False, 'message': 'Unknown URI %s' % uri}



Mime
View raw message