bosprimigenious commented on code in PR #1074:
URL: https://github.com/apache/dubbo-go-pixiu/pull/1074#discussion_r4462799794


##########
pkg/common/util/stringutil/stringutil.go:
##########
@@ -68,29 +68,28 @@ func IsMatchAll(key string) bool {
 }
 
 func GetTrieKey(method string, path string) string {
-       // "http://localhost:8882/api/v1/test-dubbo/user?name=tc/";
+       // Query delimiters must not be interpreted as authority or path 
delimiters.
+       path, _, _ = strings.Cut(path, "?")
        ret := ""
 
        if strings.Contains(path, constant.ProtocolSlash) {
                path = path[strings.Index(path, 
constant.ProtocolSlash)+len(constant.ProtocolSlash):]
-               path = path[strings.Index(path, constant.PathSlash)+1:]
+               if slash := strings.Index(path, constant.PathSlash); slash >= 0 
{
+                       path = path[slash+1:]
+               } else {
+                       path = ""
+               }

Review Comment:
   Reproduced on d66996b: `/proxy/http://example.com` generated `GET` and 
matched a configured root route. Fixed in appended commit 
`0276a200881bbbd1733d0e8eb1c7cac121a63a53` by recognizing only a valid leading 
scheme. Embedded `://` and escaped path bytes now remain path data.
   
   Added regression/root-route cases; all 31 leaf cases now pass (8 failed 
before). The 4 affected tested packages pass under race; the independent router 
Put/Match/Find/Delete controls and original 131 assertions were also rerun. The 
new head is kept draft/NOT READY pending its own upstream CI; the old head's 
green result is not reused.



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