Hacker News new | past | comments | ask | show | jobs | submit login

> But the Range header surely can't be used here, since it's a request header and this is a response.

We're currently discussing how to interpret RFC 2616 (http 1.1) for this here: https://github.com/tus/tus-resumable-upload-protocol/issues/...

If you have a better suggestions than using the Range header that will still allow clients to send multiple file chunks in parallel, I'd be very interested in it!

> Do you really need this info in the response anyway? The sender knows what they sent, and either it was entirely successful (a 2xx response) or it wasn't.

We don't need it for the PUT request, but we do need it for HEAD. Adding it to PUT is redundant, but simplifies the logic for clients who choose to upload multiple chunks in parallel.

> Also, if you're going to return a zero-length 200 response, you might as well use 204 No Content instead.

Good point, I'll investigate on that: https://github.com/tus/tus-resumable-upload-protocol/issues/...

> And the Content-Length should surely be 70, since that's how much content would be returned if this was a GET request.

It's 100. We haven't specified GET requests yet, but a server could stream an upload in this case until all bytes have been received.

Anyway, this is awesome feedback - thank you so much!




> We're currently discussing how to interpret RFC 2616 (http 1.1) for this here: https://github.com/tus/tus-resumable-upload-protocol/issues/...

I've followed up with further comments there.

> If you have a better suggestions than using the Range header that will still allow clients to send multiple file chunks in parallel, I'd be very interested in it!

I don't see a way to support parallel transfers using only existing HTTP headers (without violating the HTTP spec). I would suggest maybe proposing a new header in the HTTPbis WG. For example, something like Available-Ranges that returns a ranges-specifier indicating the set of ranges that are avaiable.

This could possibly be returned as part of a 416 response when attempting to GET a file that isn't entirely available yet. A HEAD request would thus return the same thing.

> It's 100. We haven't specified GET requests yet, but a server could stream an upload in this case until all bytes have been received.

The reason I brought up a GET request is because "the metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request." (section 9.4 of RFC2616)

If you haven't got all 100 bytes yet, your GET request can't return a Content-Length of 100, thus your HEAD request shouldn't be returning 100 either.

I would have thought you would return whatever content you had available (hence the 70 bytes), but if you want to support parallel transfers, then a 416 error response indicating the available ranges might make more sense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: