rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ding...@apache.org
Subject [rocketmq-client-go] branch master updated: [#540] Fix parse address error when address has prefix "t"
Date Mon, 02 Nov 2020 07:46:46 GMT
This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new e1d9be8  [#540] Fix parse address error when address has prefix "t"
e1d9be8 is described below

commit e1d9be806c182c142aee212eab27e413705f4e79
Author: 赵鹏飞 <1216114309@qq.com>
AuthorDate: Mon Nov 2 15:46:36 2020 +0800

    [#540] Fix parse address error when address has prefix "t"
    
    in same cases, such as addr="http://tim.test.com:9876", then
    strings.TrimLeft(addr, "http(s)://") will get "im.test.com:9876" instead
    of "tim.test.com:9876"
    
    Signed-off-by: pengfei <julien.zpf@alibaba-inc.com>
---
 internal/namesrv.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/internal/namesrv.go b/internal/namesrv.go
index 371b431..a47bbc1 100644
--- a/internal/namesrv.go
+++ b/internal/namesrv.go
@@ -127,7 +127,10 @@ func (s *namesrvs) getNameServerAddress() string {
 	}
 	index %= len(s.srvs)
 	s.index = index
-	return strings.TrimLeft(addr, "http(s)://")
+	if strings.HasPrefix(addr, "https") {
+		return strings.TrimPrefix(addr, "https://")
+	}
+	return strings.TrimPrefix(addr, "http://")
 }
 
 func (s *namesrvs) Size() int {


Mime
View raw message