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

Deal with URLs with literal IPv6 addresses #645

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions prober/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,9 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr
level.Error(logger).Log("msg", "Could not parse target URL", "err", err)
return false
}
targetHost, targetPort, err := net.SplitHostPort(targetURL.Host)
// If split fails, assuming it's a hostname without port part.
if err != nil {
targetHost = targetURL.Host
}

targetHost := targetURL.Hostname()
targetPort := targetURL.Port()

ip, lookupTime, err := chooseProtocol(ctx, module.HTTP.IPProtocol, module.HTTP.IPProtocolFallback, targetHost, registry, logger)
if err != nil {
Expand Down