Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conformance: fix ipv6 addresses #2024

Merged
merged 2 commits into from
May 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 + "]"
howardjohn marked this conversation as resolved.
Show resolved Hide resolved
}
return host
}

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