prevent crash for unknown response codes

set text for unknown status code, otherwise when None is used exception occurs.
This commit is contained in:
aryeh 2017-04-16 10:07:29 -04:00 committed by GitHub
parent 28bd09a2ea
commit ff0632001c

View File

@ -210,7 +210,7 @@ class HTTPResponse(BaseHTTPResponse):
# Speeds up response rate 6% over pulling from all
status = COMMON_STATUS_CODES.get(self.status)
if not status:
status = ALL_STATUS_CODES.get(self.status)
status = ALL_STATUS_CODES.get(self.status, b'UNKNOWN RESPONSE')
return (b'HTTP/%b %d %b\r\n'
b'Connection: %b\r\n'