STS - Only check request-body of eligible requests for Actions
This commit is contained in:
parent
50111929cc
commit
25d1e1059e
@ -139,12 +139,16 @@ class DomainDispatcherApplication(object):
|
|||||||
def get_action_from_body(self, environ):
|
def get_action_from_body(self, environ):
|
||||||
body = None
|
body = None
|
||||||
try:
|
try:
|
||||||
request_body_size = int(environ.get("CONTENT_LENGTH", 0))
|
# AWS requests use querystrings as the body (Action=x&Data=y&...)
|
||||||
if "wsgi.input" in environ:
|
simple_form = environ["CONTENT_TYPE"].startswith(
|
||||||
|
"application/x-www-form-urlencoded"
|
||||||
|
)
|
||||||
|
request_body_size = int(environ["CONTENT_LENGTH"])
|
||||||
|
if simple_form and request_body_size:
|
||||||
body = environ["wsgi.input"].read(request_body_size).decode("utf-8")
|
body = environ["wsgi.input"].read(request_body_size).decode("utf-8")
|
||||||
body_dict = dict(x.split("=") for x in str(body).split("&"))
|
body_dict = dict(x.split("=") for x in body.split("&"))
|
||||||
return body_dict["Action"]
|
return body_dict["Action"]
|
||||||
except ValueError:
|
except (KeyError, ValueError):
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
if body:
|
if body:
|
||||||
|
Loading…
Reference in New Issue
Block a user