Skip to content

Commit b3486c1

Browse files
committed
Add sanity target scheme validation
1 parent fb4b6f0 commit b3486c1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

probe.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ func validateProbeParams(cfg *config.Config, q url.Values) (string, *config.Auth
2222
if target == "" {
2323
return "", nil, errMissingTarget
2424
}
25+
26+
// If the target does not contain an URL scheme, default to http.
27+
// This allows users to pass "host:port" without the "http://" prefix.
28+
if !strings.Contains(target, "://") {
29+
target = "http://" + target
30+
}
31+
2532
if _, err := url.Parse(target); err != nil {
2633
return "", nil, errInvalidTarget
2734
}

0 commit comments

Comments
 (0)