From bd23ce84c36f4c04226d2aae71ce9c76fb642868 Mon Sep 17 00:00:00 2001 From: Philip Laine Date: Fri, 6 Dec 2024 13:33:29 +0100 Subject: [PATCH] Add accept ranges header to blob HEAD request Signed-off-by: Philip Laine --- CHANGELOG.md | 1 + pkg/registry/registry.go | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b6b939..249f7e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - [#651](https://github.com/spegel-org/spegel/pull/651) Fix Containerd CRI config verification. +- [#660](https://github.com/spegel-org/spegel/pull/660) Add accept ranges header to blob HEAD request. ### Security diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index 019efdf4..9024c2fe 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -335,6 +335,7 @@ func (r *Registry) handleBlob(rw mux.ResponseWriter, req *http.Request, ref refe rw.WriteError(http.StatusInternalServerError, fmt.Errorf("could not determine size of blob with digest %s: %w", ref.dgst.String(), err)) return } + rw.Header().Set("Accept-Ranges", "bytes") rw.Header().Set("Content-Type", "application/octet-stream") rw.Header().Set("Content-Length", strconv.FormatInt(size, 10)) rw.Header().Set("Docker-Content-Digest", ref.dgst.String())