mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
3bee2f6011
commit
23d4047790
1 changed files with 7 additions and 1 deletions
|
@ -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':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue