Skip to content

Commit

Permalink
Do not append the port to authority (#12350)
Browse files Browse the repository at this point in the history
* Do not append the port to authority

* Clean up code

* Call SplitHostPort only when domain has a port
  • Loading branch information
nak3 committed Nov 25, 2021
1 parent abf4d69 commit 95f1681
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/e2e/grpc_test.go
Expand Up @@ -73,19 +73,19 @@ func dial(ctx *TestContext, host, domain string) (*grpc.ClientConn, error) {
if !hasPort(host) {
host = net.JoinHostPort(host, defaultPort)
}
if !hasPort(domain) {
domain = net.JoinHostPort(domain, defaultPort)
if hasPort(domain) {
var err error
domain, _, err = net.SplitHostPort(domain)
if err != nil {
return nil, err
}
}

secureOpt := grpc.WithInsecure()
if test.ServingFlags.HTTPS {
tlsConfig := test.TLSClientConfig(context.Background(), ctx.t.Logf, ctx.clients)
// Set ServerName for pseudo hostname with TLS.
var err error
tlsConfig.ServerName, _, err = net.SplitHostPort(domain)
if err != nil {
return nil, err
}
tlsConfig.ServerName = domain
secureOpt = grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))
}

Expand Down

0 comments on commit 95f1681

Please sign in to comment.