Skip to content

Commit 7441bc1

Browse files
authored
Add Tus-Min/Max-Chunk-Size headers
See #89 for the underlying discussion
1 parent 26184cb commit 7441bc1

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

protocol.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,29 @@ The `Tus-Max-Size` response header MUST be a non-negative integer indicating the
182182
allowed size of an entire upload in bytes. The Server SHOULD set this header if
183183
there is a known hard limit.
184184

185+
#### Tus-Min-Chunk-Size
186+
187+
The `Tus-Min-Chunk-Size` response header MUST be a non-negative integer indicating the
188+
recommended minimum size of a single chunk uploaded in a single `PATCH` request in bytes.
189+
The Server MAY set this recommendation if the underlying storage engine has a lower limit
190+
on how much data can be stored in a single take. The Client SHOULD use this number to
191+
determine in conjunction with other factors, such as the available bandwidth and the
192+
`Tus-Max-Chunk-Size` header, how much data SHOULD be transfered in one request. Furthermore,
193+
this header's value MAY represent a hard limit but also MAY be a recommendation. The Server
194+
SHOULD only set this header if it has this recommendation.
195+
196+
#### Tus-Max-Chunk-Size
197+
198+
The `Tus-Max-Chunk-Size` response header MUST be a non-negative integer indicating the
199+
recommended maximum size of a single chunk uploaded in a single `PATCH` request in bytes.
200+
The Server MAY set this recommendation if the underlying storage engine has an upper limit
201+
on how much data can be stored in a single take or if the used architecture does not allow
202+
streaming the body of the `PATCH` request. The Client SHOULD use this number to determine
203+
in conjunction with other factors, such as the available bandwidth and the
204+
`Tus-Min-Chunk-Size` header, how much data SHOULD be transfered in one request. Furthermore,
205+
this header's value MAY represent a hard limit but also MAY be a recommendation. The Server
206+
SHOULD only set this header if it has this recommendation.
207+
185208
#### X-HTTP-Method-Override
186209

187210
The `X-HTTP-Method-Override` request header MUST be a string which MUST be
@@ -237,8 +260,8 @@ The Server SHOULD always attempt to store as much of the received data as possib
237260

238261
An `OPTIONS` request MAY be used to gather information about the Server's current
239262
configuration. A successful response indicated by the `204 No Content` status
240-
MUST contain the `Tus-Version` header. It MAY include the `Tus-Extension` and
241-
`Tus-Max-Size` headers.
263+
MUST contain the `Tus-Version` header. It MAY include the `Tus-Extension`,
264+
`Tus-Max-Size`, `Tus-Min-Chunk-Size` and `Tus-Max-Chunk-Size` headers.
242265

243266
The Client SHOULD NOT include the `Tus-Resumable` header in the request and the
244267
Server MUST ignore the header.
@@ -248,8 +271,9 @@ Server MUST ignore the header.
248271
This example clarifies the response for an `OPTIONS` request. The version used
249272
in both, request and response, is `1.0.0` while the Server is also capable of
250273
handling `0.2.2` and `0.2.1`. Uploads with a total size of up to 1GB are
251-
allowed and the extensions for [Creation](#creation) and
252-
[Expiration](#expiration) are enabled.
274+
allowed and the Server recommends that a single chunk should be smaller than
275+
500MB. Furthermore, the [Creation](#creation) and [Expiration](#expiration)
276+
extensions are enabled.
253277

254278
**Request:**
255279

@@ -266,6 +290,7 @@ HTTP/1.1 204 No Content
266290
Tus-Resumable: 1.0.0
267291
Tus-Version: 1.0.0,0.2.2,0.2.1
268292
Tus-Max-Size: 1073741824
293+
Tus-Max-Chunk-Size: 524288000
269294
Tus-Extension: creation,expiration
270295
```
271296

0 commit comments

Comments
 (0)