summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-09-11 22:39:25 +0200
committerMiloslav Trmač <mitr@redhat.com>2021-12-10 18:16:20 +0100
commit1589d70bcb522e49c75632c4e0edff52d2e459c2 (patch)
tree60d469f87895d5f4f561538d3409d0f9c3e3d18f /pkg
parent2946e83493e2628c68819357ebc15bada38d45b5 (diff)
downloadpodman-1589d70bcb522e49c75632c4e0edff52d2e459c2.tar.gz
podman-1589d70bcb522e49c75632c4e0edff52d2e459c2.tar.bz2
podman-1589d70bcb522e49c75632c4e0edff52d2e459c2.zip
Use Header.Values in GetCredentials.has
It's possibly a bit more expensive, but semantically safer because it does header normalization. And we'll regain the cost by not looking up the value repeatedly. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/auth/auth.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go
index 8e4cb6959..9a4e2af85 100644
--- a/pkg/auth/auth.go
+++ b/pkg/auth/auth.go
@@ -34,8 +34,8 @@ const XRegistryConfigHeader HeaderAuthName = "X-Registry-Config"
// the necessary authentication information for libpod operations
func GetCredentials(r *http.Request) (*types.DockerAuthConfig, string, error) {
has := func(key HeaderAuthName) bool {
- hdr, found := r.Header[key.String()]
- return found && len(hdr) > 0
+ hdr := r.Header.Values(key.String())
+ return len(hdr) > 0
}
switch {
case has(XRegistryConfigHeader):