summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-13 14:57:08 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-13 14:57:08 (GMT)
commit23d40477909054d8c0e7459601093ba750b4ea8b (patch)
treec7b6571df7e67026c879e9916abdc171e673c67f /Lib/httplib.py
parent3bee2f60112f6552e5993d1735a464b358e6ab69 (diff)
downloadcpython-23d40477909054d8c0e7459601093ba750b4ea8b.zip
cpython-23d40477909054d8c0e7459601093ba750b4ea8b.tar.gz
cpython-23d40477909054d8c0e7459601093ba750b4ea8b.tar.bz2
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.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 6c3b5e0..fb87099 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -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':