MCPcopy Index your code
hub / github.com/docker/docker-agent / isLocalhostHTTP

Function isLocalhostHTTP

pkg/config/sources.go:475–481  ·  view source on GitHub ↗

isLocalhostHTTP reports whether rawURL is an http:// URL targeting localhost.

(rawURL string)

Source from the content-addressed store, hash-verified

473
474// isLocalhostHTTP reports whether rawURL is an http:// URL targeting localhost.
475func isLocalhostHTTP(rawURL string) bool {
476 u, err := url.Parse(rawURL)
477 if err != nil {
478 return false
479 }
480 return u.Scheme == "http" && u.Hostname() == "localhost"
481}
482
483// validateAgentURL enforces that an agent URL uses HTTPS, with an exception
484// for http://localhost which is allowed for local development. SSRF protection

Callers 2

ReadMethod · 0.85
validateAgentURLFunction · 0.85

Calls 1

ParseMethod · 0.80

Tested by

no test coverage detected