From eeec10387bc969ad658f37eef0cdd706b1ad42aa Mon Sep 17 00:00:00 2001 From: Wang Yan Date: Fri, 31 May 2024 16:19:39 +0800 Subject: [PATCH] [cherry-pick] fix http client to push sbom accessory (#20528) fix http client to push sbom accessory Signed-off-by: wang yan --- src/pkg/scan/util.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/pkg/scan/util.go b/src/pkg/scan/util.go index 8cb88a88f..e965b1ad7 100644 --- a/src/pkg/scan/util.go +++ b/src/pkg/scan/util.go @@ -16,7 +16,6 @@ package scan import ( "fmt" - "net/http" "github.com/google/go-containerregistry/pkg/authn" "github.com/google/go-containerregistry/pkg/name" @@ -29,22 +28,14 @@ import ( "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" - commonhttp "github.com/goharbor/harbor/src/common/http" - "github.com/goharbor/harbor/src/lib/log" + http_common "github.com/goharbor/harbor/src/common/http" "github.com/goharbor/harbor/src/pkg/robot/model" v1sq "github.com/goharbor/harbor/src/pkg/scan/rest/v1" ) // RemoteOptions ... func RemoteOptions() []remote.Option { - tr := http.DefaultTransport.(*http.Transport).Clone() - if commonhttp.InternalEnableVerifyClientCert() { - tlsConfig, err := commonhttp.GetInternalTLSConfig() - if err != nil { - log.Errorf("SBOM client load cert file with err: %v", err) - } - tr.TLSClientConfig = tlsConfig - } + tr := http_common.GetHTTPTransport(http_common.WithInsecure(true)) return []remote.Option{remote.WithTransport(tr)} }