More complete understanding of Auth header based on the docs

This commit is contained in:
Klaas van Schelven
2023-11-10 18:07:55 +01:00
parent bb8de31717
commit d01652a6f1
5 changed files with 30 additions and 28 deletions

View File

@@ -1,12 +0,0 @@
def parse_auth_header(header):
# Sentry has code in place here to parse bytes (from latin1). Based on how Django works, I'd like to think that's
# not needed. https://github.com/getsentry/sentry/pull/12108 is the non-explanation
# if isinstance(header, bytes): header = header.decode("latin1")
try:
_, rhs = header.split(" ", 1)
return {
k: v for (k, v) in [part.strip().split('=', 1) for part in rhs.split(",")]
}
except Exception:
return {}