mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Handle duplicate content-length
This commit is contained in:
parent
b798412444
commit
bd8670b4db
@ -131,6 +131,8 @@ class Message(object):
|
|||||||
content_length = None
|
content_length = None
|
||||||
for (name, value) in self.headers:
|
for (name, value) in self.headers:
|
||||||
if name == "CONTENT-LENGTH":
|
if name == "CONTENT-LENGTH":
|
||||||
|
if content_length is not None:
|
||||||
|
raise InvalidHeader("CONTENT-LENGTH", req=self)
|
||||||
content_length = value
|
content_length = value
|
||||||
elif name == "TRANSFER-ENCODING":
|
elif name == "TRANSFER-ENCODING":
|
||||||
chunked = value.lower() == "chunked"
|
chunked = value.lower() == "chunked"
|
||||||
|
|||||||
5
tests/requests/invalid/021.http
Normal file
5
tests/requests/invalid/021.http
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
GET /stuff/here?foo=bar HTTP/1.1\r\n
|
||||||
|
Content-Length: 3\r\n
|
||||||
|
Content-Length: 2\r\n
|
||||||
|
\r\n
|
||||||
|
xyz
|
||||||
5
tests/requests/invalid/021.py
Normal file
5
tests/requests/invalid/021.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from gunicorn.config import Config
|
||||||
|
from gunicorn.http.errors import InvalidHeader
|
||||||
|
|
||||||
|
cfg = Config()
|
||||||
|
request = InvalidHeader
|
||||||
Loading…
x
Reference in New Issue
Block a user