mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
merge with 3.3
This commit is contained in:
commit
b89b5df9c9
13 changed files with 191 additions and 38 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue