From 7cc393871703ebfd8027432336530a2034af3e94 Mon Sep 17 00:00:00 2001 From: Erik Wilson Date: Wed, 30 Oct 2019 16:10:28 -0700 Subject: [PATCH] Set default scheme in registryEndpoints for host Signed-off-by: Erik Wilson --- pkg/server/image_pull.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/server/image_pull.go b/pkg/server/image_pull.go index bb7c3ed71..196bfbf37 100644 --- a/pkg/server/image_pull.go +++ b/pkg/server/image_pull.go @@ -310,10 +310,6 @@ func (c *criService) registryHosts(auth *runtime.AuthConfig) docker.RegistryHost config = c.config.Registry.Configs[u.Host] ) - if u.Scheme == "" { - u.Scheme = defaultScheme(u.Host) - } - if u.Scheme != "https" && config.TLS != nil { return nil, errors.Errorf("tls provided for http endpoint %q", e) } @@ -355,8 +351,7 @@ func defaultScheme(host string) string { if h, _, err := net.SplitHostPort(host); err == nil { host = h } - if host == "localhost" || host == "127.0.0.1" || - host == "::1" { + if host == "localhost" || host == "127.0.0.1" || host == "::1" { return "http" } return "https" @@ -387,7 +382,7 @@ func (c *criService) registryEndpoints(host string) ([]string, error) { return endpoints, nil } } - return append(endpoints, "https://"+defaultHost), nil + return append(endpoints, defaultScheme(defaultHost)+"://"+defaultHost), nil } // newTransport returns a new HTTP transport used to pull image.