Similarityoung opened a new issue, #920:
URL: https://github.com/apache/dubbo-go-pixiu/issues/920

   ### ✅ 验证清单
   
   - [x] 🔍 我已经搜索过 [现有 
Issues](https://github.com/apache/dubbo-go-pixiu/issues),确信这不是重复问题
   
   ### 🚀 Go 版本
   
   1.25
   
   ### 📦 Dubbo-go-pixiu 版本
   
   latest
   
   ### 🖥️ 服务端配置
   
   _No response_
   
   ### 💻 客户端配置
   
   _No response_
   
   ### 🌐 协议配置
   
   _No response_
   
   ### 📋 注册中心配置
   
   _No response_
   
   ### 💾 操作系统
   
   🍎 macOS
   
   ### 📝 Bug 描述
   
   在 Pixiu route 配置中,`methods: ["*"]` 语义应表示匹配任意 method。这个语义对非 HTTP 场景也很重要,例如 
Dubbo/Triple route 中的 RPC method 匹配。
   
   历史实现里,router 会把 method 和 path 拼成同一个 trie key,例如:
   
   ```text
   */com.example.UserService
   ```
   
   trie 本身支持 `*` 作为单段通配符,因此 `methods: ["*"]` 可以匹配任意实际 method。
   
   但在 route snapshot 重构之后,router 改成了按 method 分桶:
   
   ```go
   MethodTries map[string]*trie.Trie
   ```
   
   构建阶段会把 `methods: ["*"]` 放入:
   
   ```go
   MethodTries["*"]
   ```
   
   查询阶段却直接按实际 method 精确取:
   
   ```go
   t := s.MethodTries[method]
   ```
   
   如果实际 method 是 `$invoke`、`GetUser`、`UpdateOrder` 等,就只会查 
`MethodTries["$invoke"]` / `MethodTries["GetUser"]` / 
`MethodTries["UpdateOrder"]`,不会 fallback 到 `MethodTries["*"]`。这样 `methods: 
["*"]` 实际变成了只匹配字面量 `*`,不再具备通配语义。
   
   典型错误表现为:
   
   ```text
   route failed for <method>/<path>, no rules matched
   Requested dubbo rpc invocation route not found
   ```
   
   **期望行为:**
   
   `methods: ["*"]` 应继续表示匹配任意 method,而不是只匹配字面量 `*`。
   
   `RouteByPathAndName(path, method)` 在按实际 method 找不到 trie 时,应 fallback 到 
wildcard trie:
   
   ```go
   t := s.MethodTries[method]
   if t == nil {
       t = s.MethodTries["*"]
   }
   ```
   
   同时,header-only route 的 method 判断也应保留同样语义:
   
   ```go
   if x == "*" || x == m {
       return true
   }
   ```
   
   **影响范围:**
   
   所有依赖 `methods: ["*"]` 表示“任意 method”的 route 都可能受影响,尤其是 Dubbo/Triple 这类非 HTTP 
method 路由场景。
   
   这个问题不应该通过把各个配置里的 `*` 改成具体 method 来规避。更合理的修复是在 router 层恢复 `*` 的 method 
wildcard 语义。
   
   ### 🔄 重现步骤
   
   none
   
   ### ✅ 预期行为
   
    none
   
   ### ❌ 实际行为
   
    none
   
   ### 💡 可能的解决方案
   
   _No response_


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to