Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit 9036c0e

Browse files
committed
Ensure we treat headers as ASCII strings.
1 parent 99a48f5 commit 9036c0e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

httpsig/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def generate_message(required_headers, headers, host=None, method=None, path=Non
5858

5959

6060
def parse_authorization_header(header):
61-
auth = header.split(' ', 1)
61+
if not isinstance(header, six.string_types):
62+
header = header.decode("ascii") #HTTP headers cannot be Unicode.
63+
64+
auth = header.split(" ", 1)
6265
if len(auth) > 2:
6366
raise ValueError('Invalid authorization header. (eg. Method key1=value1,key2="value, \"2\"")')
6467

0 commit comments

Comments
 (0)