fix basic auth logging

decoding of basic auth header. fix #2625
This commit is contained in:
Benoit Chesneau 2023-05-07 21:05:41 +02:00 committed by GitHub
parent 4a1c402e2c
commit a7ead9831e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -469,8 +469,7 @@ class Logger(object):
# so we need to convert it to a byte string
auth = base64.b64decode(auth[1].strip().encode('utf-8'))
# b64decode returns a byte string
auth = auth.decode('utf-8')
auth = auth.split(":", 1)
auth.split(b":", 1)[0].decode(UTF-8", "replace")
except (TypeError, binascii.Error, UnicodeDecodeError) as exc:
self.debug("Couldn't get username: %s", exc)
return user