You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2019/09/19 10:31:45 UTC
svn commit: r1867169 - /comdev/reporter.apache.org/trunk/scripts/wsgi.py
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}