Commit 23d40477 authored by Jeremy Hylton's avatar Jeremy Hylton

SF patch #405845 by Martin von Löwis

Fixes SF bug #405427.
If an http response has a bogus return code, e.g. 400.100, raise
BadStatusLine.
parent 3bee2f60
......@@ -126,7 +126,13 @@ class HTTPResponse:
self.close()
raise BadStatusLine(line)
self.status = status = int(status)
# The status code is a three-digit number
try:
self.status = status = int(status)
if status < 100 or status > 999:
raise BadStatusLine(line)
except ValueError:
raise BadStatusLine(line)
self.reason = reason.strip()
if version == 'HTTP/1.0':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment