Skip to content

Commit

Permalink
HTTPS for registry requests
Browse files Browse the repository at this point in the history
  • Loading branch information
hweawer committed Jan 26, 2025
1 parent 1ead1d8 commit 38a48a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/backend/registrybackend/blobclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -52,8 +52,8 @@ func (f *blobClientFactory) Create(
return NewBlobClient(config, stats)
}

const _layerquery = "http://%s/v2/%s/blobs/sha256:%s"
const _manifestquery = "http://%s/v2/%s/manifests/sha256:%s"
const _layerquery = "https://%s/v2/%s/blobs/sha256:%s"
const _manifestquery = "https://%s/v2/%s/manifests/sha256:%s"

// BlobClient stats and downloads blob from registry.
type BlobClient struct {
Expand Down
12 changes: 5 additions & 7 deletions lib/backend/testfs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -85,8 +85,7 @@ func (c *Client) Stat(namespace, name string) (*core.BlobInfo, error) {
if err != nil {
return nil, fmt.Errorf("pather: %s", err)
}
resp, err := httputil.Head(
fmt.Sprintf("https://%s/files/%s", c.config.Addr, p))
resp, err := httputil.Head(fmt.Sprintf("http://%s/files/%s", c.config.Addr, p))
if err != nil {
if httputil.IsNotFound(err) {
return nil, backenderrors.ErrBlobNotFound
Expand All @@ -107,7 +106,7 @@ func (c *Client) Upload(namespace, name string, src io.Reader) error {
return fmt.Errorf("pather: %s", err)
}
_, err = httputil.Post(
fmt.Sprintf("https://%s/files/%s", c.config.Addr, p),
fmt.Sprintf("http://%s/files/%s", c.config.Addr, p),
httputil.SendBody(src))
return err
}
Expand All @@ -118,8 +117,7 @@ func (c *Client) Download(namespace, name string, dst io.Writer) error {
if err != nil {
return fmt.Errorf("pather: %s", err)
}
resp, err := httputil.Get(
fmt.Sprintf("https://%s/files/%s", c.config.Addr, p))
resp, err := httputil.Get(fmt.Sprintf("http://%s/files/%s", c.config.Addr, p))
if err != nil {
if httputil.IsNotFound(err) {
return backenderrors.ErrBlobNotFound
Expand All @@ -145,7 +143,7 @@ func (c *Client) List(prefix string, opts ...backend.ListOption) (*backend.ListR
}

resp, err := httputil.Get(
fmt.Sprintf("https://%s/list/%s", c.config.Addr, path.Join(c.pather.BasePath(), prefix)))
fmt.Sprintf("http://%s/list/%s", c.config.Addr, path.Join(c.pather.BasePath(), prefix)))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 38a48a7

Please sign in to comment.