If I read the spec correctly, PATCH method is actually more of APPEND, no? It would seem logical and practical to allow PATCH to modify any part of a resource that is already present on the server and/or to extend it by appending. This would also make the whole thing useful beyond resuming of interrupted uploads, e.g. to allow for rsync-style updating of existing files.
Open Protocol for Resumable File Uploads
21–30 of 45 posts
Re: Open Protocol for Resumable File Uploads
#22Earlier quoted context omitted.
> An origin server that allows PUT on a given target resource MUST send > a 400 (Bad Request) response to a PUT request that contains a > Content-Range header field (Section 4.2 of [RFC7233]), https://tools.ietf.org/html/rfc7231#section-4.3.4
Maybe that should be fixed, then. HTTP PUT with the range specified seem to me it would be sensible.
Re: Open Protocol for Resumable File Uploads
#23Does it use anything fancy like fountain codes or does it just renegotiate chunks each time or something else?
Re: Open Protocol for Resumable File Uploads
#24There is a ruby implementation too: https://github.com/janko-m/tus-ruby-server
Re: Open Protocol for Resumable File Uploads
#25Is there a TL;DR? I see the whole spec is there but I don't have time to read it just this second. Does it use anything fancy like fountain codes or does it just renegotiate chunks each time or something else?
Re: Open Protocol for Resumable File Uploads
#26Is there a TL;DR? I see the whole spec is there but I don't have time to read it just this second. Does it use anything fancy like fountain codes or does it just renegotiate chunks each time or something else?
1. The client POSTs, this allocates a unique Location which the server returns and
2. the client saves this (e.g. in localStorage) along with local file identifiers so it can be looked up later and can
3. query that URL to check how many bytes were already received, and then
4. PATCH the remaining bytes
Repeat step 3 & 4 on failures/resumes.
Re: Open Protocol for Resumable File Uploads
#27Re: Open Protocol for Resumable File Uploads
#28Earlier quoted context omitted.
Maybe that should be fixed, then. HTTP PUT with the range specified seem to me it would be sensible.
Responding with 400 Bad Request is actually something that was added after some servers allowed Content-Range on PUT and others didn't. It was never standard, but the end-result was that some clients assumed PUT + Content-Range would work, which meant that some servers would apply the change while others would ignore the header and overwrite the entire resource with the chunk. There's no sane way to add support for t…
KISS. Endow the "400 Bad Request" server response with a special header that acts like a cookie or nonce, with the semantics "this server does support Content-Range uploads and won't corrupt your resource". If the client resends the PUT + Content-Range request with the correct cookie/nonce added to it, it has acknowledged this semantics in turn, and the upload can now go through. This adds a roundtrip, but it's still trivial compared to what's being proposed here, and keeps the semantics of PATCH open for more complicated cases.
Re: Open Protocol for Resumable File Uploads
#29S3 Multi-Part Upload API can be used to chunk an object into smaller parts, which can succeed or fail independently. https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview....
Yes that is very helpful. Our s3 storage backend for tusd uses it, and our https://uppy.io file uploader does too, usable directly from the browser (so you can choose to not use tus at all with it). S3 resumable uploads do come with a few limitations that make some people still choose tus tho: * chunks need to be >5MB which can be problematic on flaky/poor connections (rural areas, tunnels, clubs/basements, people on…
Re: Open Protocol for Resumable File Uploads
#30If I read the spec correctly, PATCH method is actually more of APPEND, no? It would seem logical and practical to allow PATCH to modify any part of a resource that is already present on the server and/or to extend it by appending. This would also make the whole thing useful beyond resuming of interrupted uploads, e.g. to allow for rsync-style updating of existing files.
Yes, APPEND is not an official HTTP method though. Allowing to modify parts at any location makes things a little bit more complex and comes with some overhead. If you do need to upload multiple chunks simultaneously, you can opt into our Concat extension however, which does exactly that. Our latest blog posts has some images to illustrate.
My point is that you appear to be pushing for adoption of an extension that handles one specific use case for PATCH, when a more general extension is trivially possible with little to no extra effort.