Skip to content

Commit

Permalink
Merge pull request #802 from fangyincheng/fix-path
Browse files Browse the repository at this point in the history
Fix:fixed url encode
  • Loading branch information
AlexStocks committed Oct 26, 2020
2 parents 45a3656 + 5a089ff commit bec8195
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions registry/base_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, f creat
// Dubbo java consumer to start looking for the provider url,because the category does not match,
// the provider will not find, causing the consumer can not start, so we use consumers.

if len(c.Methods) == 0 {
if len(c.Methods) != 0 {
params.Add(constant.METHODS_KEY, strings.Join(c.Methods, ","))
}
logger.Debugf("provider url params:%#v", params)
Expand All @@ -326,7 +326,8 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, f creat
}
host += ":" + c.Port

rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, params.Encode())
s, _ := url.QueryUnescape(params.Encode())
rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, s)
// Print your own registration service providers.
dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), (common.RoleType(common.PROVIDER)).String())
logger.Debugf("provider path:%s, url:%s", dubboPath, rawURL)
Expand Down Expand Up @@ -361,7 +362,8 @@ func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, f creat
}

params.Add("protocol", c.Protocol)
rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, params.Encode())
s, _ := url.QueryUnescape(params.Encode())
rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, s)
dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), (common.RoleType(common.CONSUMER)).String())

logger.Debugf("consumer path:%s, url:%s", dubboPath, rawURL)
Expand Down

0 comments on commit bec8195

Please sign in to comment.