router and escaping urls

22 views
Skip to first unread message

Dave S

unread,
Dec 18, 2019, 1:14:05 AM12/18/19
to web...@googlegroups.com

In rewrite.py, the default pattern for validating args in the request URL is
 args_match=r'([\w@ =-]|(?<=[\w@ -])[.])*$'

while the default pattern for files [file names?} is
 file_match = r'([-+=@$%\w]|(?<=[-+=@$%\w])[./])*$' # legal static subpath

Note that file_match includes '%', but args_match does not.  '%' is used for URL-escaping characters outside the ASCII range.

I have a controller path that goes .../app1/default/func1, and in normal usage I'm appending a (string) value being passed to func1.
That is, .../default/func1/somevalue.   When there's an escaped character, the rewrite code seems to be throwing HTTP 400 due to failing to match with args_match.  Why would this behavior be chosen?

By contrast, the client using (app2) func2 uses a '?' to introduce the arg (.../app2/default/func2?somevalue2), and that is accepted with escaped chars.

My routes.py uses the "simple router" (around line 104 of the sample), where BASE is set to a dict of default_application and root_static.  Can I overwrite args_match in this?  app1 is the default_application.

/dps




Reply all
Reply to author
Forward
0 new messages