summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-10-27 06:46:09 (GMT)
committerGeorg Brandl <georg@python.org>2013-10-27 06:46:09 (GMT)
commitb89b5df9c9aa2e45bfffa95f5e3deb6234232c93 (patch)
treefd9bfa96b2e5cbc69acc235dd15dd682c10fc00e /Lib/http
parent68457be619b919127d0858322ce84e901fd89728 (diff)
parent045ee06ae91a1503a8d512929c54e16deabfe9a8 (diff)
downloadcpython-b89b5df9c9aa2e45bfffa95f5e3deb6234232c93.zip
cpython-b89b5df9c9aa2e45bfffa95f5e3deb6234232c93.tar.gz
cpython-b89b5df9c9aa2e45bfffa95f5e3deb6234232c93.tar.bz2
merge with 3.3
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/client.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index 939615b..6e32c7b 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -214,6 +214,8 @@ MAXAMOUNT = 1048576
# maximal line length when calling readline().
_MAXLINE = 65536
+_MAXHEADERS = 100
+
class HTTPMessage(email.message.Message):
# XXX The only usage of this method is in
@@ -261,6 +263,8 @@ def parse_headers(fp, _class=HTTPMessage):
if len(line) > _MAXLINE:
raise LineTooLong("header line")
headers.append(line)
+ if len(headers) > _MAXHEADERS:
+ raise HTTPException("got more than %d headers" % _MAXHEADERS)
if line in (b'\r\n', b'\n', b''):
break
hstring = b''.join(headers).decode('iso-8859-1')