diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-12-18 16:55:23 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-12-18 16:55:23 (GMT) |
commit | 5466bf1c94d38e75bc053b0cfc163e2f948fe345 (patch) | |
tree | ee76b8a66c739f7b7d2b6cb747f1bf7cbd5181d6 /Lib/http/server.py | |
parent | 32e1771daf0ebbde326d91dede4b9cfae6e74f27 (diff) | |
download | cpython-5466bf1c94d38e75bc053b0cfc163e2f948fe345.zip cpython-5466bf1c94d38e75bc053b0cfc163e2f948fe345.tar.gz cpython-5466bf1c94d38e75bc053b0cfc163e2f948fe345.tar.bz2 |
Fix Issue6791 - Limit the HTTP header readline with _MAXLENGTH. Patch by Antoine Pitrou
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r-- | Lib/http/server.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index f1538f4..515572f 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -314,8 +314,12 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): self.command, self.path, self.request_version = command, path, version # Examine the headers and look for a Connection directive. - self.headers = http.client.parse_headers(self.rfile, - _class=self.MessageClass) + try: + self.headers = http.client.parse_headers(self.rfile, + _class=self.MessageClass) + except http.client.LineTooLong: + self.send_error(400, "Line too long") + return False conntype = self.headers.get('Connection', "") if conntype.lower() == 'close': |