Merge pull request #404 from ThomasWaldmann/basic-auth-exception
catch exception for invalid http basic auth strings, fixes #401
This commit is contained in:
commit
282b1786ac
@ -119,7 +119,11 @@ def basic_authenticate(auth):
|
|||||||
:return: username, password [unicode on py2, str on py3]
|
:return: username, password [unicode on py2, str on py3]
|
||||||
"""
|
"""
|
||||||
assert isinstance(auth, str)
|
assert isinstance(auth, str)
|
||||||
|
try:
|
||||||
authmeth, auth = auth.split(' ', 1)
|
authmeth, auth = auth.split(' ', 1)
|
||||||
|
except ValueError:
|
||||||
|
# splitting failed, invalid auth string
|
||||||
|
return
|
||||||
if authmeth.lower() != 'basic':
|
if authmeth.lower() != 'basic':
|
||||||
return
|
return
|
||||||
# we ignore bytes that do not decode. username (hostname) and password
|
# we ignore bytes that do not decode. username (hostname) and password
|
||||||
|
Loading…
x
Reference in New Issue
Block a user