tus / tus-resumable-upload-protocol

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

Do we need a separate request to create uploads? #27

Closed technoweenie closed 11 years ago

technoweenie commented 11 years ago

The file creation extension suggests an initial POST to create the file on the server:

POST /files HTTP/1.1
Host: tus.example.org
Content-Length: 0
Final-Length: 100

Any thoughts on allowing clients attempt to upload the complete file to that request? If the upload finishes, you can respond the same (201 with a Location header). If it fails, return the appropriate HTTP status and the Location header. That way clients only have to worry about the resumable protocol when necessary.

felixge commented 11 years ago

@technoweenie sure, we can change the text so clients are allowed to send some or all of the data along with the file creation request. But consider the problem below:

If it fails, return the appropriate HTTP status and the Location header. That way clients only have to worry about the resumable protocol when necessary.

If the network fails, the server has no way to respond to the client. This means the client won't receive a Location header, and won't be able to resume the upload as it doesn't know the url for making the resume request. That's why it doesn't make a lot of sense to send data along with the file creation request. What do you think?

technoweenie commented 11 years ago

That's a good point. The connection will just drop with no response headers or status.