Skip to content

Commit

Permalink
fix basic auth logging
Browse files Browse the repository at this point in the history
decoding of basic auth header. fix #2625
  • Loading branch information
benoitc committed May 7, 2023
1 parent 4a1c402 commit a7ead98
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions gunicorn/glogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,7 @@ def _get_user(self, environ):
# 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
Expand Down

0 comments on commit a7ead98

Please sign in to comment.