Skip to content

Commit 394db03

Browse files
committed
Fix all media types in Accept header to match RFC
Fixes the media type to align with Accept HTTP header RFC which specifies glob syntax */* See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Signed-off-by: Derek McGowan <[email protected]>
1 parent 6624f62 commit 394db03

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

remotes/docker/fetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R
136136
}
137137

138138
func (r dockerFetcher) open(ctx context.Context, req *request, mediatype string, offset int64) (io.ReadCloser, error) {
139-
req.header.Set("Accept", strings.Join([]string{mediatype, `*`}, ", "))
139+
req.header.Set("Accept", strings.Join([]string{mediatype, `*/*`}, ", "))
140140

141141
if offset > 0 {
142142
// Note: "Accept-Ranges: bytes" cannot be trusted as some endpoints

remotes/docker/pusher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
8080
}
8181

8282
req := p.request(host, http.MethodHead, existCheck...)
83-
req.header.Set("Accept", strings.Join([]string{desc.MediaType, `*`}, ", "))
83+
req.header.Set("Accept", strings.Join([]string{desc.MediaType, `*/*`}, ", "))
8484

8585
log.G(ctx).WithField("url", req.String()).Debugf("checking and pushing to")
8686

remotes/docker/resolver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func NewResolver(options ResolverOptions) remotes.Resolver {
155155
images.MediaTypeDockerSchema2Manifest,
156156
images.MediaTypeDockerSchema2ManifestList,
157157
ocispec.MediaTypeImageManifest,
158-
ocispec.MediaTypeImageIndex, "*"}, ", "))
158+
ocispec.MediaTypeImageIndex, "*/*"}, ", "))
159159
} else {
160160
resolveHeader["Accept"] = options.Headers["Accept"]
161161
delete(options.Headers, "Accept")

0 commit comments

Comments
 (0)