tus / tus-resumable-upload-protocol

Open Protocol for Resumable File Uploads
https://tus.io
MIT License
1.5k stars 102 forks source link

Is it valid to POST the `location` in the response of POST before? #72

Closed FuGangqiang closed 9 years ago

FuGangqiang commented 9 years ago

After POST a upload url, I will get the location for upload, after a few PATCHs, is it valid to POST the location url?

In the second POST, is it valid to update metadata and upload-length(if defer upload length)?

Acconut commented 9 years ago

Since a POST request to an existing upload URL is not defined in tus, it's theoretically not forbidden but we discourage such behaviour. Currently, there is no mechanism for updating metadata but the length can be deferred as described in https://github.com/tus/tus-resumable-upload-protocol/blob/046960aa214564a11d118f3c39b426aef673f7c1/protocol.md#post (but only once, you cannot change it twice).

FuGangqiang commented 9 years ago

Maybe I didn't describe the question of the upload-length clearly, and again:

Is Upload-Length only set by PATCH when Upload-Defer-Length? can it be set in a POST request when Upload-Defer-Length?

Acconut commented 9 years ago

Thanks for clarifying your question. As I said a POST request against an upload URL is not defined by the specification and therefore not valid according to protocol (although it's not strictly forbidden). So the answers are:

Is Upload-Length only set by PATCH when Upload-Defer-Length?

Yes.

can it be set in a POST request when Upload-Defer-Length?

No.

Could the origin of your question be that your platform/programming language does not support the PATCH method? If so, we support the X-HTTP-Method-Override header which allows you to use POST instead.

FuGangqiang commented 9 years ago

I got it! Thanks for your patience in answering all my questions!