Repository: milvus-io/milvus-sdk-go (go)

Issue:
[Bug]: SDK cannot connect to https scheme URL
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

for plain https://in01-instanceXXX...zillizcloud.com (without port)
Go sdk will still try to connect to 80 port, which may lead to connection failure

### Expected Behavior

Auto use 443(default https port) for https scheme url

### Steps To Reproduce

_No response_

### Environment

_No response_

### Anything else?

_No response_

Pull request:
Auto fill 443 port for https schema url
Resolves #526 
/kind improvement

Patch:
diff --git a/client/config.go b/client/config.go
index 241cc18..5293f53 100644
--- a/client/config.go
+++ b/client/config.go
@@ -112,6 +112,9 @@ func (c *Config) parse() error {
 	if remoteURL.Scheme == "https" {
 		c.EnableTLSAuth = true
 	}
+	if remoteURL.Port() == "" && c.EnableTLSAuth {
+		remoteURL.Host += ":443"
+	}
 	c.parsedAddress = remoteURL
 	return nil
 }


Test patch:
diff --git a/client/config_test.go b/client/config_test.go
index 0f33ed6..201f213 100644
--- a/client/config_test.go
+++ b/client/config_test.go
@@ -52,7 +52,7 @@ func TestClientConfig(t *testing.T) {
 		&Config{
 			Address: "https://xxxx-xxxx-xxxxx.com",
 		},
-		"xxxx-xxxx-xxxxx.com", "", true, false,
+		"xxxx-xxxx-xxxxx.com:443", "", true, false,
 	)
 	// remote https host with dbname
 	assertConfig(