summaryrefslogtreecommitdiff
path: root/Lib/http/server.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-12-18 18:04:38 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-12-18 18:04:38 +0000
commitff1bbba92aad261df1ebd8fd8cc189c104e113b0 (patch)
treeef057b096c5c46b024919cdfcb32591725643fde /Lib/http/server.py
parenta2eb94b1cf65e422ec8e3fb3f417d496cf80167b (diff)
downloadcpython-git-ff1bbba92aad261df1ebd8fd8cc189c104e113b0.tar.gz
Merged revisions 87373,87381 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87373 | senthil.kumaran | 2010-12-18 17:55:23 +0100 (sam., 18 déc. 2010) | 3 lines Fix Issue6791 - Limit the HTTP header readline with _MAXLENGTH. Patch by Antoine Pitrou ........ r87381 | antoine.pitrou | 2010-12-18 18:59:18 +0100 (sam., 18 déc. 2010) | 3 lines NEWS entry for r87373 ........
Diffstat (limited to 'Lib/http/server.py')
-rw-r--r--Lib/http/server.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 5ac6c0d204..8de604a739 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':