Commits

Anonymous committed 2265032

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.

Comments (0)

Files changed (1)

             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':