mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Updating Content-Length Handling
Signed-off-by: Jason Myers <jmyers@syntellis.com>
This commit is contained in:
parent
add8a4c951
commit
fa94f70529
@ -139,7 +139,10 @@ class Message(object):
|
||||
self.body = Body(ChunkedReader(self, self.unreader))
|
||||
elif content_length is not None:
|
||||
try:
|
||||
content_length = int(content_length)
|
||||
if str(content_length).isnumeric():
|
||||
content_length = int(content_length)
|
||||
else:
|
||||
raise InvalidHeader("CONTENT-LENGTH", req=self)
|
||||
except ValueError:
|
||||
raise InvalidHeader("CONTENT-LENGTH", req=self)
|
||||
|
||||
|
||||
3
tests/requests/invalid/022.http
Normal file
3
tests/requests/invalid/022.http
Normal file
@ -0,0 +1,3 @@
|
||||
GET /first HTTP/1.0\r\n
|
||||
Content-Length: -0\r\n
|
||||
\r\n
|
||||
5
tests/requests/invalid/022.py
Normal file
5
tests/requests/invalid/022.py
Normal file
@ -0,0 +1,5 @@
|
||||
from gunicorn.config import Config
|
||||
from gunicorn.http.errors import InvalidHeader
|
||||
|
||||
cfg = Config()
|
||||
request = InvalidHeader
|
||||
3
tests/requests/invalid/023.http
Normal file
3
tests/requests/invalid/023.http
Normal file
@ -0,0 +1,3 @@
|
||||
GET /first HTTP/1.0\r\n
|
||||
Content-Length: 0_1\r\n
|
||||
\r\n
|
||||
5
tests/requests/invalid/023.py
Normal file
5
tests/requests/invalid/023.py
Normal file
@ -0,0 +1,5 @@
|
||||
from gunicorn.config import Config
|
||||
from gunicorn.http.errors import InvalidHeader
|
||||
|
||||
cfg = Config()
|
||||
request = InvalidHeader
|
||||
3
tests/requests/invalid/024.http
Normal file
3
tests/requests/invalid/024.http
Normal file
@ -0,0 +1,3 @@
|
||||
GET /first HTTP/1.0\r\n
|
||||
Content-Length: +1\r\n
|
||||
\r\n
|
||||
5
tests/requests/invalid/024.py
Normal file
5
tests/requests/invalid/024.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