summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-04-03 00:45:46 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-04-03 00:45:46 (GMT)
commitacc03195b0609490a4e5f8b1d9eb504c22c6526e (patch)
tree2ba86f93a5c19a7865088cf15c720867e21608aa /Lib/http
parentaf8363926aa1cb96483a1777d478491e7415faff (diff)
downloadcpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.zip
cpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.tar.gz
cpython-acc03195b0609490a4e5f8b1d9eb504c22c6526e.tar.bz2
Issue #26586: Handle excessive header fields in http.server, by Xiang Zhang
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/server.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py
index e1b71ab..fac4d9d 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -337,6 +337,13 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
HTTPStatus.BAD_REQUEST,
"Line too long")
return False
+ except http.client.HTTPException as err:
+ self.send_error(
+ HTTPStatus.REQUEST_HEADER_FIELDS_TOO_LARGE,
+ "Too many headers",
+ str(err)
+ )
+ return False
conntype = self.headers.get('Connection', "")
if conntype.lower() == 'close':