Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:fixed url encode #802

Merged
merged 1 commit into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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