From: Ben Darnell Date: Mon, 12 Feb 2018 03:21:11 +0000 (-0500) Subject: curl_httpclient: Only call native_str on debug message when needed X-Git-Tag: v5.0.0~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27a6103148a78100fc479f5dfc65065ef8e6ea72;p=thirdparty%2Ftornado.git curl_httpclient: Only call native_str on debug message when needed Some debug messages are binary blobs that should not be decoded. Fixes #2275 --- diff --git a/tornado/curl_httpclient.py b/tornado/curl_httpclient.py index 1523fdcba..54fc5b36d 100644 --- a/tornado/curl_httpclient.py +++ b/tornado/curl_httpclient.py @@ -499,10 +499,11 @@ class CurlAsyncHTTPClient(AsyncHTTPClient): def _curl_debug(self, debug_type, debug_msg): debug_types = ('I', '<', '>', '<', '>') - debug_msg = native_str(debug_msg) if debug_type == 0: + debug_msg = native_str(debug_msg) curl_log.debug('%s', debug_msg.strip()) elif debug_type in (1, 2): + debug_msg = native_str(debug_msg) for line in debug_msg.splitlines(): curl_log.debug('%s %s', debug_types[debug_type], line) elif debug_type == 4: