From: Ant Zucaro Date: Sat, 22 Apr 2017 19:50:48 +0000 (-0400) Subject: Raise HTTP 422 if the submission doesn't parse. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e9ccf6b67114c697fab89c3a06a450fddfde2be3;p=xonotic%2Fxonstat.git Raise HTTP 422 if the submission doesn't parse. --- diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index a3bd3e3..e0ada1c 100644 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -1056,7 +1056,15 @@ def submit_stats(request): "----- END REQUEST BODY -----\n\n") (idfp, status) = verify_request(request) - submission = Submission(request.body, request.headers) + try: + submission = Submission(request.body, request.headers) + except: + msg = "Invalid submission" + log.debug(msg) + raise pyramid.httpexceptions.HTTPUnprocessableEntity( + body=msg, + content_type="text/plain" + ) do_precondition_checks(request.registry.settings, submission)