From 9a1a2ef9e334a21a0b74c4874894cba187168e13 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 29 Oct 2018 13:44:11 -0700 Subject: [PATCH] Update go-containerregistry Update go-containerregistry to merge in this [PR](https://github.com/google/go-containerregistry/pull/293) and fix --- Gopkg.lock | 5 ++--- Gopkg.toml | 4 ++++ .../go-containerregistry/pkg/v1/remote/transport/basic.go | 3 ++- .../go-containerregistry/pkg/v1/remote/transport/bearer.go | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 410e2aae1..b11e5ee73 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -430,8 +430,7 @@ version = "v0.2.0" [[projects]] - branch = "master" - digest = "1:764d0a9bb2c987d9333c5b0a256bc94791db50c0b5be2fa10f2247b1dcbd7a04" + digest = "1:f1b23f53418c1b035a5965ac2600a28b16c08643683d5213fb581ecf4e79a02a" name = "github.com/google/go-containerregistry" packages = [ "pkg/authn", @@ -450,7 +449,7 @@ "pkg/v1/v1util", ] pruneopts = "NUT" - revision = "24bbadfcffb5e05b1578cb2bd5438992ada3b546" + revision = "88d8d18eb1bde1fcef23c745205c738074290515" [[projects]] digest = "1:f4f203acd8b11b8747bdcd91696a01dbc95ccb9e2ca2db6abf81c3a4f5e950ce" diff --git a/Gopkg.toml b/Gopkg.toml index bf5263598..9431660cc 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -35,6 +35,10 @@ required = [ name = "k8s.io/client-go" version = "kubernetes-1.11.0" +[[constraint]] + name = "github.com/google/go-containerregistry" + revision = "88d8d18eb1bde1fcef23c745205c738074290515" + [[override]] name = "k8s.io/apimachinery" version = "kubernetes-1.11.0" diff --git a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go index 752038cb1..e77f47f69 100644 --- a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go +++ b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/basic.go @@ -39,7 +39,8 @@ func (bt *basicTransport) RoundTrip(in *http.Request) (*http.Response, error) { // abstraction, so to avoid forwarding Authorization headers to places // we are redirected, only set it when the authorization header matches // the host with which we are interacting. - if in.Host == bt.target { + // In case of redirect http.Client can use an empty Host, check URL too. + if in.Host == bt.target || in.URL.Host == bt.target { in.Header.Set("Authorization", hdr) } in.Header.Set("User-Agent", transportName) diff --git a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go index a45121390..2bfdb6e24 100644 --- a/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go +++ b/vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/bearer.go @@ -56,7 +56,8 @@ func (bt *bearerTransport) RoundTrip(in *http.Request) (*http.Response, error) { // abstraction, so to avoid forwarding Authorization headers to places // we are redirected, only set it when the authorization header matches // the registry with which we are interacting. - if in.Host == bt.registry.RegistryStr() { + // In case of redirect http.Client can use an empty Host, check URL too. + if in.Host == bt.registry.RegistryStr() || in.URL.Host == bt.registry.RegistryStr() { in.Header.Set("Authorization", hdr) } in.Header.Set("User-Agent", transportName)