mirror of
https://github.com/django/daphne.git
synced 2024-11-25 09:13:44 +03:00
only encode header keys as utf8 when not already bytes
This commit is contained in:
parent
cc870105f1
commit
61454dafb5
|
@ -33,7 +33,7 @@ def parse_x_forwarded_for(headers,
|
|||
headers = {name.lower(): values for name, values in headers.items()}
|
||||
else:
|
||||
# Lowercase and encode header keys
|
||||
headers = {name.lower().encode("utf-8"): values for name, values in headers.items()}
|
||||
headers = {name.lower() if isinstance(name, bytes) else name.lower().encode("utf-8"): values for name, values in headers.items()}
|
||||
|
||||
address_header_name = address_header_name.lower().encode("utf-8")
|
||||
result = original
|
||||
|
|
Loading…
Reference in New Issue
Block a user