wklken opened a new issue, #10555:
URL: https://github.com/apache/apisix/issues/10555

   ### Description
   
   use
   
   ```
   apisix:
       router:
           http: 'radixtree_uri_with_parameter'
   ```
   
   then register a route like `/api/test/prod/cn/:word/`
   
   then
   
   ```
   $ curl "http://0.0.0.0:6006/api/test/prod/cn/%E4%B8%AD%E6%96%87/";
   ```
   
   will got 404;
   
   set the log level to debug, and add some log
   
   ```
   2023/11/28 02:36:19 [info] 1859#1859: *115647 [lua] 
radixtree_uri_with_parameter.lua:69: match(): route match mode: 
radixtree_uri_with_parameter, client: 127.0.0.1, server: _, request: "GET 
/api/test/prod/cn/%E4%B8%AD%E6%96%87/ HTTP/1.1", host: "0.0.0.0:6006"
   
   # api_ctx.var.uri 
   2023/11/28 02:36:19 [info] 1859#1859: *115647 [lua] 
radixtree_uri_with_parameter.lua:71: match(): /api/test/prod/cn/中文/, client: 
127.0.0.1, server: _, request: "GET /api/test/prod/cn/%E4%B8%AD%E6%96%87/ 
HTTP/1.1", host: "0.0.0.0:6006"
   
   # api_ctx.var.real_request_uri
   2023/11/28 02:36:19 [info] 1859#1859: *115647 [lua] 
radixtree_uri_with_parameter.lua:72: match(): 
/api/test/prod/cn/%E4%B8%AD%E6%96%87/, client: 127.0.0.1, server: _, request: 
"GET /api/test/prod/cn/%E4%B8%AD%E6%96%87/ HTTP/1.1", host: "0.0.0.0:6006"
   
   # api_ctx.var.request_uri
   2023/11/28 02:36:19 [info] 1859#1859: *115647 [lua] 
radixtree_uri_with_parameter.lua:73: match(): /api/test/prod/cn/中文/, client: 
127.0.0.1, server: _, request: "GET /api/test/prod/cn/%E4%B8%AD%E6%96%87/ 
HTTP/1.1", host: "0.0.0.0:6006"
   
   # it will use api_ctx.var.uri to call 
   # uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx, match_opts)
   # will not match
   2023/11/28 02:36:19 [debug] 1859#1859: *115647 [lua] radixtree.lua:497: 
compare_param(): path_org: /api/test/prod/cn/:word/?
   2023/11/28 02:36:19 [debug] 1859#1859: *115647 [lua] radixtree.lua:498: 
compare_param(): pcre pat: 
\/api\/test\/prod\/cn\/([\w\-_;:@&=!',\%\$\.\+\*\(\)]+)\/?
   2023/11/28 02:36:19 [debug] 1859#1859: *115647 [lua] radixtree.lua:503: 
compare_param(): req_path: /api/test/prod/cn/中文/
   ```
   
   and the resty/radixtree.lua
   
   ```lua
   local function fetch_pat(path)
      ...
               -- See https://www.rfc-editor.org/rfc/rfc1738.txt BNF for 
specific URL schemes
               res[i] = [=[([\w\-_;:@&=!',\%\$\.\+\*\(\)]+)]=]
   ```
   
   ------
   
   So, why use a decoded uri to call `uri_router:dispatch`, while the 
resty/radixtree.lua require a encoded uri? 
   
   
   
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.2.1
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to