Skip to content

Commit

Permalink
fix only cloud serverless cluster port must be 443.
Browse files Browse the repository at this point in the history
Signed-off-by: “yelusion” <[email protected]>
  • Loading branch information
yelusion2 committed Oct 17, 2023
1 parent bc4fdb1 commit b89d1eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public static class MilvusConsts {
public final static String HOST_HTTPS_PREFIX = "https://";

public final static String HOST_HTTP_PREFIX = "http://";

public final static String CLOUD_SERVERLESS_URI_REGEX = "^https://in03-.{20,}zilliz.*.com$";
}
public static class StringValue {
public final static String COLON = ":";
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/io/milvus/param/ConnectParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

import static io.milvus.common.constant.MilvusClientConstant.MilvusConsts.CLOUD_SERVERLESS_URI_REGEX;
import static io.milvus.common.constant.MilvusClientConstant.MilvusConsts.HOST_HTTPS_PREFIX;

/**
* Parameters for client connection.
Expand Down Expand Up @@ -353,12 +357,15 @@ protected void verify() throws ParamException {
this.databaseName = result.getDatabase();
}

if(host.startsWith(HOST_HTTPS_PREFIX)){
this.secure = true;
}

if (StringUtils.isNotEmpty(token)) {
this.authorization = Base64.getEncoder().encodeToString(String.format("%s", token).getBytes(StandardCharsets.UTF_8));
if (!token.contains(":")) {
if (Pattern.matches(CLOUD_SERVERLESS_URI_REGEX, this.uri)) {
this.port = 443;
}
this.secure = true; //
}

if (port < 0 || port > 0xFFFF) {
Expand Down

0 comments on commit b89d1eb

Please sign in to comment.