[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-08-28 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-1695310456

   > 
https://github.com/TencentBlueKing/blueking-apigateway-operator/blob/60f0cd4c1ea59b169ba47e55b23a6af8d2dabf8c/pkg/commiter/conversion/resource.go#L61C6-L61C40
   
   I just open issue here. 
   
   


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-08-02 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-1663250854

   
https://github.com/TencentBlueKing/blueking-apigateway-operator/blob/60f0cd4c1ea59b169ba47e55b23a6af8d2dabf8c/pkg/commiter/conversion/resource.go#L61C6-L61C40
   
   we set the `priority` to fix the issue; make it act like `the longest path 
match`
   
   


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-05-09 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-1541206696

   
   after check 
[lua-resty-radixtree](https://github.com/api7/lua-resty-radixtree) and [chi 
router](https://github.com/go-chi/chi)
   
   Conclusion:
   
   1. Without any parameters and subpath, the result is independent of the 
registration order, and the longest match is used.
   - path: `/api/test/prod/test`
   - path: `/api/test/prod/`
   2. Without any parameters, but with subpath, the result is independent of 
the registration order, and the longest match is used.
   - path: `/api/test/prod/*subp`
   - path: `/api/test/prod/webconsole/*subp`
   3. With parameters and subpath, the result is dependent on the registration 
order and is not the longest match (this is not an issue with the golang 
version of radixtree).
   - path: `/api/test/prod/:v/*subp`
   - path: `/api/test/prod/:v/webconsole/*subp`
   - path: `/api/test/prod/v4/webconsole/*subp`


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-04-24 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-1521173847

   ```lua
  local rx = radix.new({
   {
   paths = {"/api/prod/:version/test/api/foo/?"},
   metadata = "metadata long",
   },
   {
   paths = {"/api/prod/:version/test/*subp"},
   metadata = "metadata short",
   },
   })
   
   local opts = {
   host = "foo.com",
   method = "GET",
   remote_addr = "127.0.0.1",
   vars = ngx.var,
   }
   local path = "/api/prod/v4/test/api/foo/"
   local metadata = rx:match(path, opts)
   core.log.error(metadata)
   ```


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-04-24 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-152485

   change 
   - `short` to `/api/prod/:version/test/*subpath_match_param_name`
   - `long` to `/api/prod/:version/test/api/?`
   
   the result still the same. 
   


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] wklken commented on issue #9366: bug: Adding routes to a Radix Tree in a different order can lead to the same URL matching the first added route instead of the longest path match

2023-04-24 Thread via GitHub


wklken commented on issue #9366:
URL: https://github.com/apache/apisix/issues/9366#issuecomment-1521087621

   If the long route only has one param in its path (e.g. 
/api/prod/:version/test/api/portal/projects/?), then the curl command will 
always match the long route. In other words, it seems that the radixtree 
library does not currently support multiple parameters in the path for matching.


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org