You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2020/10/26 11:23:39 UTC

[dubbo-go] branch develop updated: fixed url encode

This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 5a089ff  fixed url encode
     new bec8195  Merge pull request #802 from fangyincheng/fix-path
5a089ff is described below

commit 5a089ffc565b15892c0f17b0f0bda49d492a1dc2
Author: fangyincheng <fa...@sina.com>
AuthorDate: Sun Oct 25 03:53:16 2020 +0800

    fixed url encode
---
 registry/base_registry.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/registry/base_registry.go b/registry/base_registry.go
index ad1a3b6..e7d38df 100644
--- a/registry/base_registry.go
+++ b/registry/base_registry.go
@@ -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)
@@ -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)
@@ -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)