This occurs in cases like RequestHandler.get_argument which
build their own message string instead of passing a printf
string and args to HTTPError.
Fixes #1393.
path_args=["a/b", "c/d"],
args={}))
+ def test_error(self):
+ # Percent signs (encoded as %25) should not mess up printf-style
+ # messages in logs
+ with ExpectLog(gen_log, ".*Invalid unicode"):
+ self.fetch("/group/?arg=%25%e9")
+
class TypeCheckHandler(RequestHandler):
def prepare(self):
self.log_message = log_message
self.args = args
self.reason = kwargs.get('reason', None)
+ if log_message and not args:
+ self.log_message = log_message.replace('%', '%%')
def __str__(self):
message = "HTTP %d: %s" % (