Re: Draft v1 Update for Resumable Uploads

> On Jun 16, 2022, at 14:30, Guoye Zhang <guoye_zhang@apple.com> wrote:
> 
> 1. Content-Range
> 
> We attempted adopting Content-Range header, however, we realized that it doesn’t support unknown lengths which is an important use case that our clients require. Therefore we kept Upload-Offset and Upload-Incomplete headers.
> 
> We are open to discuss other options, such as modifying the semantics of the Content-Range header if that’s preferred, although it might cause more breakages than defining new headers.

The Content-Range header does support unknown lengths <https://httpwg.org/specs/rfc9110.html#field.content-range>:

> An asterisk character ("*") in place of the complete-length indicates that the representation length was unknown when the header field was generated.

For example:
Content-Range: bytes 42-1233/*
And again, while you can’t use this in requests… you could use it in a new media type (see below).

> 2. Media types
> 
> PATCH currently doesn’t define a media type. We went through the list of media types but couldn’t find the appropriate category for the Upload Appending Procedure. It is a generic byte-appending operation that can modify any types of media, so we don’t think it fits into an application media type.
> 
> We are open to suggestions if a media type is desired.

I believe a media type is required, you’re supposed to define one to use with PATCH.

By doing this, you also guarantee that the server will support resumption, since servers that do not will error "415 Unsupported Media Type”.

I’m working on a draft for “message/byte-range” that would suit this purpose perfectly. Its entire function would be to overwrite the specified byte range with some content. I’ve previously shared an I-D that includes this media type among other things, but I am going to split it out because it’s reusable for so many other purposes. Watch the httpapi list.

> 3. 1xx intermediate response
> 
> We surveyed the most popular HTTP libraries in many languages, and nearly all of them consider 1xx responses an internal signaling mechanism so they don’t expose the ability for applications to handle them. (We are also guilty of this as maintainers of URLSession API on Apple platforms.) If we use 1xx response for any critical information, it would prevent nearly all tus-v1 adopters to switch to this new protocol until it’s natively supported in HTTP libraries.
> 
> We think having just the feature detection part using 1xx response is a good balance, both eliminating any extra round trips for HTTP libraries implementing this protocol and allowing application adopters to ignore it.
> 
> 4. Can we PATCH a PATCH?
> 
> Yes, Upload Creation Procedure supports any method, including PATCH. We included a section “Request Identification” about the nuances in this area. Unfortunately, this added complexity is the result of splitting the procedures, but we don’t think it will complicate the implementations in most cases. Servers can still decide what methods make sense for their use case and whether to support PATCH.

Some other remarks:

1. Upload-Token should be unnecessary in requests, the server should use a URI to identify operations in progress.

2. Upload-Offset as a new header should be unnecessary, this data can be stored in the PATCH body.

3. Feature detection: Feature detection is not a reliable way to ensure that your request will be understood correctly. In general, the request must have the expected effect even if sent to a server that doesn’t understand it. This easy to ensure this by using a new method, or a new media type, in the request.


Cheers,

Austin.

> 
> 
> Looking forward to continuing the discussions and refinements of the draft.
> 
> Best regards,
> Guoye Zhang

Received on Friday, 17 June 2022 00:59:51 UTC