From 770936f1f9b56010011c2af7f5f854d88f1c1d4f Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 21 Sep 2016 19:21:32 -0700 Subject: raise TypeError on invalid header assignment, fix #1562 --- netlib/http/headers.py | 1 + 1 file changed, 1 insertion(+) (limited to 'netlib/http/headers.py') diff --git a/netlib/http/headers.py b/netlib/http/headers.py index 131e8ce5..b55874ca 100644 --- a/netlib/http/headers.py +++ b/netlib/http/headers.py @@ -14,6 +14,7 @@ if six.PY2: # pragma: no cover return x def _always_bytes(x): + strutils.always_bytes(x, "utf-8", "replace") # raises a TypeError if x != str/bytes/None. return x else: # While headers _should_ be ASCII, it's not uncommon for certain headers to be utf-8 encoded. -- cgit v1.2.3