Skip to content

Commit 3c6a879

Browse files
authored
Merge pull request #239 from jonjohnsonjr/srmu
Describe single-request monolithic upload behavior
2 parents e734841 + fd1b013 commit 3c6a879

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

spec.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -197,36 +197,12 @@ There are two ways to push blobs: chunked or monolithic.
197197
##### Pushing a blob monolithically
198198

199199
There are two ways to push a blob monolithically:
200-
1. A single `POST` request
201-
2. A `POST` request followed by a `PUT` request
200+
1. A `POST` request followed by a `PUT` request
201+
2. A single `POST` request
202202

203203
---
204204

205-
To push a blob monolithically by using a single POST request, perform a `POST` request to a URL in the following form, and with the following headers and body:
206-
207-
`/v2/<name>/blobs/uploads/?digest=<digest>` <sup>[end-4b](#endpoints)</sup>
208-
```
209-
Content-Length: <length>
210-
Content-Type: application/octet-stream
211-
```
212-
```
213-
<upload byte stream>
214-
```
215-
216-
Here, `<name>` is the repository's namespace, `<digest>` is the blob's digest, and `<length>` is the size (in bytes) of the blob.
217-
218-
The `Content-Length` header MUST match the blob's actual content length. Likewise, the `<digest>` MUST match the blob's digest.
219-
220-
Successful completion of the request MUST return either a `201 Created` or a `202 Accepted`, and MUST include the following header:
221-
222-
```
223-
Location: <blob-location>
224-
```
225-
226-
Here, `<blob-location>` is a pullable blob URL. This location does not necessarily have to be served by your register, for example, in the case of a signed URL from
227-
some cloud storage provider that your registry generates.
228-
229-
---
205+
###### POST then PUT
230206

231207
To push a blob monolithically by using a POST request followed by a PUT request, there are two steps:
232208
1. Obtain a session id (upload URL)
@@ -270,6 +246,39 @@ Location: <blob-location>
270246

271247
With `<blob-location>` being a pullable blob URL.
272248

249+
---
250+
251+
###### Single POST
252+
253+
Registries MAY support pushing blobs using a single POST request.
254+
255+
To push a blob monolithically by using a single POST request, perform a `POST` request to a URL in the following form, and with the following headers and body:
256+
257+
`/v2/<name>/blobs/uploads/?digest=<digest>` <sup>[end-4b](#endpoints)</sup>
258+
```
259+
Content-Length: <length>
260+
Content-Type: application/octet-stream
261+
```
262+
```
263+
<upload byte stream>
264+
```
265+
266+
Here, `<name>` is the repository's namespace, `<digest>` is the blob's digest, and `<length>` is the size (in bytes) of the blob.
267+
268+
The `Content-Length` header MUST match the blob's actual content length. Likewise, the `<digest>` MUST match the blob's digest.
269+
270+
Registries that do not support single request monolithic uploads SHOULD return a `202 Accepted` status code and `Location` header and clients SHOULD proceed with a subsequent PUT request, as described by the [POST then PUT upload method](#post-then-put).
271+
272+
Successful completion of the request MUST return a `201 Created` and MUST include the following header:
273+
274+
```
275+
Location: <blob-location>
276+
```
277+
278+
Here, `<blob-location>` is a pullable blob URL. This location does not necessarily have to be served by your register, for example, in the case of a signed URL from
279+
some cloud storage provider that your registry generates.
280+
281+
273282
##### Pushing a blob in chunks
274283

275284
A chunked blob upload is accomplished in three phases:

0 commit comments

Comments
 (0)