Skip to content

Commit

Permalink
curl_httpclient: Only call native_str on debug message when needed
Browse files Browse the repository at this point in the history
Some debug messages are binary blobs that should not be decoded.

Fixes #2275
  • Loading branch information
bdarnell committed Feb 12, 2018
1 parent 24d2ebd commit 27a6103
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tornado/curl_httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,11 @@ def _curl_header_callback(self, headers, header_callback, header_line):

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:
Expand Down

0 comments on commit 27a6103

Please sign in to comment.