Skip to content

Commit

Permalink
Merge branch 'oauth2cli/dev' to close #546
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Dec 29, 2023
2 parents 1ae2d19 + 72b853d commit dcedc10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion msal/oauth2cli/authcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def _escape(key_value_pairs):
return {k: escape(v) for k, v in key_value_pairs.items()}


def _printify(text):
# If an https request is sent to an http server, the text needs to be repr-ed
return repr(text) if isinstance(text, str) and not text.isprintable() else text


class _AuthCodeHandler(BaseHTTPRequestHandler):
def do_GET(self):
# For flexibility, we choose to not check self.path matching redirect_uri
Expand Down Expand Up @@ -135,7 +140,8 @@ def _send_full_response(self, body, is_ok=True):
self.wfile.write(body.encode("utf-8"))

def log_message(self, format, *args):
logger.debug(format, *args) # To override the default log-to-stderr behavior
# To override the default log-to-stderr behavior
logger.debug(format, *map(_printify, args))


class _AuthCodeHttpServer(HTTPServer, object):
Expand Down

0 comments on commit dcedc10

Please sign in to comment.