Merge pull request #412 from Unrud/patch-12

Veify Authorization Scheme
This commit is contained in:
Guillaume Ayoub 2016-05-26 13:52:08 +02:00
commit 05d76bd2d3

View File

@ -251,8 +251,8 @@ class Application:
# Ask authentication backend to check rights
authorization = environ.get("HTTP_AUTHORIZATION", None)
if authorization:
authorization = authorization.lstrip("Basic").strip()
if authorization and authorization.startswith("Basic"):
authorization = authorization[len("Basic"):].strip()
user, password = self.decode(base64.b64decode(
authorization.encode("ascii")), environ).split(":", 1)
else: