mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Remove strict check of Transfer-Encoding
This commit is contained in:
parent
f74324bd75
commit
ddf5e66ac8
@ -118,11 +118,3 @@ class ForbiddenProxyRequest(ParseException):
|
||||
class InvalidSchemeHeaders(ParseException):
|
||||
def __str__(self):
|
||||
return "Contradictory scheme headers"
|
||||
|
||||
|
||||
class UnsupportedTransferEncoding(ParseException):
|
||||
def __init__(self, te):
|
||||
self.te = te
|
||||
|
||||
def __str__(self):
|
||||
return "Unsupported Transfer-Encoding: %s" % self.te
|
||||
|
||||
@ -12,7 +12,7 @@ from gunicorn.http.unreader import SocketUnreader
|
||||
from gunicorn.http.body import ChunkedReader, LengthReader, EOFReader, Body
|
||||
from gunicorn.http.errors import (InvalidHeader, InvalidHeaderName, NoMoreData,
|
||||
InvalidRequestLine, InvalidRequestMethod, InvalidHTTPVersion,
|
||||
LimitRequestLine, LimitRequestHeaders, UnsupportedTransferEncoding)
|
||||
LimitRequestLine, LimitRequestHeaders)
|
||||
from gunicorn.http.errors import InvalidProxyLine, ForbiddenProxyRequest
|
||||
from gunicorn.http.errors import InvalidSchemeHeaders
|
||||
from gunicorn.util import bytes_to_str, split_request_uri
|
||||
@ -135,13 +135,8 @@ class Message(object):
|
||||
raise InvalidHeader("CONTENT-LENGTH", req=self)
|
||||
content_length = value
|
||||
elif name == "TRANSFER-ENCODING":
|
||||
normalized_value = value.lower()
|
||||
if normalized_value == "identity":
|
||||
pass
|
||||
elif normalized_value == "chunked":
|
||||
if value.lower() == "chunked":
|
||||
chunked = True
|
||||
else:
|
||||
raise UnsupportedTransferEncoding(normalized_value)
|
||||
elif name == "SEC-WEBSOCKET-KEY1":
|
||||
content_length = 8
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ from gunicorn.http.errors import (
|
||||
InvalidProxyLine, InvalidRequestLine,
|
||||
InvalidRequestMethod, InvalidSchemeHeaders,
|
||||
LimitRequestHeaders, LimitRequestLine,
|
||||
UnsupportedTransferEncoding
|
||||
)
|
||||
from gunicorn.http.wsgi import Response, default_environ
|
||||
from gunicorn.reloader import reloader_engines
|
||||
@ -207,7 +206,7 @@ class Worker(object):
|
||||
LimitRequestLine, LimitRequestHeaders,
|
||||
InvalidProxyLine, ForbiddenProxyRequest,
|
||||
InvalidSchemeHeaders,
|
||||
SSLError, UnsupportedTransferEncoding)):
|
||||
SSLError)):
|
||||
|
||||
status_int = 400
|
||||
reason = "Bad Request"
|
||||
@ -238,10 +237,6 @@ class Worker(object):
|
||||
reason = "Forbidden"
|
||||
mesg = "'%s'" % str(exc)
|
||||
status_int = 403
|
||||
elif isinstance(exc, UnsupportedTransferEncoding):
|
||||
reason = "Not implemented"
|
||||
mesg = "'%s'" % str(exc)
|
||||
status_int = 501
|
||||
|
||||
msg = "Invalid request from ip={ip}: {error}"
|
||||
self.log.debug(msg.format(ip=addr[0], error=str(exc)))
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
GET /stuff/here?foo=bar HTTP/1.1\r\n
|
||||
Transfer-Encoding: chunked\r\n
|
||||
Transfer-Encoding: compress\r\n
|
||||
\r\n
|
||||
xyz
|
||||
@ -1,5 +0,0 @@
|
||||
from gunicorn.config import Config
|
||||
from gunicorn.http.errors import UnsupportedTransferEncoding
|
||||
|
||||
cfg = Config()
|
||||
request = UnsupportedTransferEncoding
|
||||
Loading…
x
Reference in New Issue
Block a user