Encoding needs a default

This commit is contained in:
Channel Cat 2017-01-16 17:03:55 -08:00
parent ccbbce0036
commit 638fbcb619

View File

@ -106,11 +106,11 @@ class HTTPResponse:
for name, value in self.headers.items(): for name, value in self.headers.items():
try: try:
headers += ( headers += (
b'%b: %b\r\n' % (name.encode(), value.encode())) b'%b: %b\r\n' % (name.encode(), value.encode('utf-8')))
except AttributeError: except AttributeError:
headers += ( headers += (
b'%b: %b\r\n' % ( b'%b: %b\r\n' % (
str(name).encode(), str(value).encode())) str(name).encode(), str(value).encode('utf-8')))
# Try to pull from the common codes first # Try to pull from the common codes first
# Speeds up response rate 6% over pulling from all # Speeds up response rate 6% over pulling from all