]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
curl_httpclient: Only call native_str on debug message when needed 2277/head
authorBen Darnell <ben@bendarnell.com>
Mon, 12 Feb 2018 03:21:11 +0000 (22:21 -0500)
committerBen Darnell <ben@bendarnell.com>
Mon, 12 Feb 2018 03:21:11 +0000 (22:21 -0500)
Some debug messages are binary blobs that should not be decoded.

Fixes #2275

tornado/curl_httpclient.py

index 1523fdcba67b34febb2b5b2ca1b8208919786fc4..54fc5b36da2d4c1bc9e428c89104908776669bb1 100644 (file)
@@ -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: