Author: sebb Date: Fri Sep 1 14:28:30 2023 New Revision: 1912042 URL: http://svn.apache.org/viewvc?rev=1912042&view=rev Log: Ensure user is defined
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=1912042&r1=1912041&r2=1912042&view=diff ============================================================================== --- comdev/reporter.apache.org/trunk/scripts/wsgi.py (original) +++ comdev/reporter.apache.org/trunk/scripts/wsgi.py Fri Sep 1 14:28:30 2023 @@ -29,13 +29,17 @@ def app(environ, start_fn): now = time.time() uri = environ.get('PATH_INFO', '/') if uri in webmap: + user = None 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) + if user: + output = webmap[uri](environ, user) + else: + output = {'okay': False, 'message': 'Not authorized'} else: output = {'okay': False, 'message': 'Unknown URI %s' % uri}