Skip to content

Commit aa0c00b

Browse files
authored
Merge pull request #595 from syed/head-requests-digest
Make Docker-Content-Digest non-optional
2 parents 05d45d0 + c2519f1 commit aa0c00b

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

spec.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ For relevant details and a history leading up to this specification, please see
4848

4949
#### Legacy Docker support HTTP headers
5050

51-
Because of the origins of this specification, the client MAY encounter Docker-specific headers, such as `Docker-Content-Digest`, or `Docker-Distribution-API-Version`.
52-
These headers are OPTIONAL and clients SHOULD NOT depend on them.
51+
Because of the origins of this specification, the client MAY encounter Docker-specific headers, such as `Docker-Distribution-API-Version`.
52+
Unless documented elsewhere in the spec, these headers are OPTIONAL and clients SHOULD NOT depend on them.
5353

5454
#### Legacy Docker support error codes
5555

@@ -174,9 +174,9 @@ If the manifest has a `mediaType` field, clients SHOULD reject unless the `media
174174
For more information on the use of `Accept` headers and content negotiation, please see [Content Negotiation](./content-negotiation.md) and [RFC7231](https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1).
175175

176176
A GET request to an existing manifest URL MUST provide the expected manifest, with a response code that MUST be `200 OK`.
177-
A successful response SHOULD contain the digest of the uploaded blob in the header `Docker-Content-Digest`.
177+
A successful response MUST contain the digest of the uploaded blob in the header `Docker-Content-Digest`.
178178

179-
The `Docker-Content-Digest` header, if present on the response, returns the canonical digest of the uploaded blob which MAY differ from the provided digest.
179+
The `Docker-Content-Digest` header, if present on the response, returns the digest of the uploaded blob which MAY differ from the provided digest.
180180
If the digest does differ, it MAY be the case that the hashing algorithms used do not match.
181181
See [Content Digests](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md#digests) <sup>[apdx-3](#appendix)</sup> for information on how to detect the hashing algorithm in use.
182182
Most clients MAY ignore the value, but if it is used, the client MUST verify the value matches the returned manifest.
@@ -192,7 +192,7 @@ To pull a blob, perform a `GET` request to a URL in the following form:
192192
`<name>` is the namespace of the repository, and `<digest>` is the blob's digest.
193193

194194
A GET request to an existing blob URL MUST provide the expected blob, with a response code that MUST be `200 OK`.
195-
A successful response SHOULD contain the digest of the uploaded blob in the header `Docker-Content-Digest`.
195+
A successful response MUST contain the digest of the uploaded blob in the header `Docker-Content-Digest`.
196196
If present, the value of this header MUST be a digest matching that of the response body.
197197
Most clients MAY ignore the value, but if it is used, the client MUST verify the value matches the returned response body.
198198
Clients SHOULD verify that the response body matches the requested digest.
@@ -210,8 +210,12 @@ In order to verify that a repository contains a given manifest or blob, make a `
210210
`/v2/<name>/blobs/<digest>` <sup>[end-2](#endpoints)</sup> (for blobs).
211211

212212
A HEAD request to an existing blob or manifest URL MUST return `200 OK`.
213-
A successful response SHOULD contain the digest of the uploaded blob in the header `Docker-Content-Digest`.
214-
A successful response SHOULD contain the size in bytes of the uploaded blob in the header `Content-Length`.
213+
A successful response MUST contain the digest of the uploaded blob or manifest in the header `Docker-Content-Digest`.
214+
A successful response MUST contain the size in bytes of the uploaded blob or manifest in the header `Content-Length`.
215+
216+
_Implementers note:_
217+
Clients may encounter registries implementing earlier spec versions which did not require the `Docker-Content-Digest` header.
218+
In such cases, the clients can reasonably assume the digest algorithm used is sha256.
215219

216220
If the blob or manifest is not found in the repository, the response code MUST be `404 Not Found`.
217221

@@ -460,7 +464,7 @@ Location: <blob-location>
460464
```
461465

462466
The Location header will contain the registry URL to access the accepted layer file.
463-
The Docker-Content-Digest header returns the canonical digest of the uploaded blob which MAY differ from the provided digest.
467+
The Docker-Content-Digest header returns the digest of the uploaded blob which MAY differ from the provided digest.
464468
Most clients MAY ignore the value but if it is used, the client SHOULD verify the value against the uploaded blob data.
465469

466470
The registry MAY treat the `from` parameter as optional, and it MAY cross-mount the blob if it can be found.
@@ -502,7 +506,7 @@ Location: <location>
502506
```
503507

504508
The `<location>` is a pullable manifest URL.
505-
The Docker-Content-Digest header returns the canonical digest of the uploaded blob, and MUST be equal to the client provided digest.
509+
The Docker-Content-Digest header returns the digest of the uploaded blob, and MUST be equal to the client provided digest.
506510
Clients MAY ignore the value but if it is used, the client SHOULD verify the value against the uploaded blob data.
507511

508512
An attempt to pull a nonexistent repository MUST return response code `404 Not Found`.

0 commit comments

Comments
 (0)