Skip to content

Commit

Permalink
conformance: fix ipv6 addresses
Browse files Browse the repository at this point in the history
This was a regression in 0.7.0-rc2
  • Loading branch information
howardjohn committed May 15, 2023
1 parent fea4334 commit 8e58c16
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions conformance/utils/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,21 @@ func calculateHost(gwAddr, scheme string) string {
return gwAddr
}
if strings.ToLower(scheme) == "http" && port == "80" {
return host
return ipv6SafeHost(host)
}
if strings.ToLower(scheme) == "https" && port == "443" {
return host
return ipv6SafeHost(host)
}
return host + ":" + port
return gwAddr
}

func ipv6SafeHost(host string) string {
// We assume that host is a literal IPv6 address if host has
// colons.
if strings.Contains(host, ':') {
return "[" + host + "]"
}
return host
}

// AwaitConvergence runs the given function until it returns 'true' `threshold` times in a row.
Expand Down

0 comments on commit 8e58c16

Please sign in to comment.