From 48efd1cbdd72001cdd47c77497f59a02cc5e6dbe Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 2 Feb 2019 12:41:03 -0500 Subject: [PATCH] httputil: Downgrade a noisy log line Only complain about unsupported content encodings if it's a content-type we'd otherwise try to parse. Fixes #2578 --- tornado/httputil.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tornado/httputil.py b/tornado/httputil.py index ec94b1b9d..835327d0a 100644 --- a/tornado/httputil.py +++ b/tornado/httputil.py @@ -777,10 +777,12 @@ def parse_body_arguments( and ``files`` parameters are dictionaries that will be updated with the parsed contents. """ - if headers and "Content-Encoding" in headers: - gen_log.warning("Unsupported Content-Encoding: %s", headers["Content-Encoding"]) - return if content_type.startswith("application/x-www-form-urlencoded"): + if headers and "Content-Encoding" in headers: + gen_log.warning( + "Unsupported Content-Encoding: %s", headers["Content-Encoding"] + ) + return try: uri_arguments = parse_qs_bytes(native_str(body), keep_blank_values=True) except Exception as e: @@ -790,6 +792,11 @@ def parse_body_arguments( if values: arguments.setdefault(name, []).extend(values) elif content_type.startswith("multipart/form-data"): + if headers and "Content-Encoding" in headers: + gen_log.warning( + "Unsupported Content-Encoding: %s", headers["Content-Encoding"] + ) + return try: fields = content_type.split(";") for field in fields: -- 2.47.2