Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: huabing zhao <[email protected]>
  • Loading branch information
zhaohuabing committed Dec 21, 2023
1 parent ad8dc69 commit ed175d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/xds/translator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import (
)

const (
defaultPort = 443
defaultHTTPSPort = 443
defaultHTTPPort = 80
)

// urlCluster is a cluster that is created from a URL.
Expand All @@ -46,7 +47,13 @@ func url2Cluster(strURL string, secure bool) (*urlCluster, error) {
return nil, fmt.Errorf("unsupported URI scheme %s", u.Scheme)
}

port := defaultPort
var port int
if u.Scheme == "https" {
port = defaultHTTPSPort
} else {
port = defaultHTTPPort
}

if u.Port() != "" {
port, err = strconv.Atoi(u.Port())
if err != nil {
Expand Down

0 comments on commit ed175d2

Please sign in to comment.