Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location: response valid with PATCH response? #155

Closed
nigoroll opened this issue Jun 8, 2020 · 7 comments
Closed

Location: response valid with PATCH response? #155

nigoroll opened this issue Jun 8, 2020 · 7 comments

Comments

@nigoroll
Copy link
Contributor

nigoroll commented Jun 8, 2020

I am working on a varnish cache vmod implementation of a TUS proxy, acting as a TUS server towards clients, to be released as open source.
One particular aspect of the use case of the initial sponsor of this implementation is to always store objects with their content hash as the last path element.

Determining the hash is possible at creation time for POSTs

  • of the complete object
  • concatenating with Upload-Concat: final;...

Yet with PATCH, the location of the object would change with every uploaded chunk (except for an empty one), so I wonder if updating it by sending a Location: response header would be allowed by the protocol.
My take is that as PATCH is serialized by design, the protocol could require clients to accept updates to the location, but I have not found any mention of this case and would thus appreciate clarification.

@nigoroll
Copy link
Contributor Author

nigoroll commented Jun 8, 2020

shortly after posting this question, I realized that the client might not receive the server's response to a partial (interrupted) PATCH upload, so the Location would be changed to a value unknown to the client. I guess this answers my question in the sense that Location must not be changed after the initial creation, but I will leave the ticket open for a bit.

@Acconut
Copy link
Member

Acconut commented Jun 8, 2020

shortly after posting this question, I realized that the client might not receive the server's response to a partial (interrupted) PATCH upload, so the Location would be changed to a value unknown to the client. I guess this answers my question in the sense that Location must not be changed after the initial creation

Exactly, you came to the right conclusion :) When dealing with unreliable networks you need to have a constant endpoint that does not change to synchronize the client's and server's progress. So changing URLs are not possible with the current design of tus.

@Acconut Acconut closed this as completed Jun 8, 2020
@nigoroll
Copy link
Contributor Author

nigoroll commented Jun 8, 2020

thank you for the quick response!

@nigoroll
Copy link
Contributor Author

nigoroll commented Jul 15, 2020

I'd like to come back to this please once more:
Yes, we can not change the upload location after the initial POST.
Yet once the upload is complete, I think we could send a Location: response with a new, permanent URL: For the final PATCH, the client would either receive the Location: or miss it. In case it misses it, it would issue another OPTIONS / HEAD and then receive a) the info that the object is complete and b) the Location:.
Would this make sense, @Acconut ?

@Acconut
Copy link
Member

Acconut commented Jul 15, 2020

Yes, it does make sense. But to be honest, this sounds very application-specific and I am not sure this is a good fit for the specification in general.

@nigoroll
Copy link
Contributor Author

I would not think support for content based URLs was particularly specific. It is a generally useful concept to implement de-duplication on the object level.
Support for a late Location: change would also enable other uses where the final location depends on the content. I could imagine naming files by type, for example, or selecting paths by size.

@Acconut
Copy link
Member

Acconut commented Aug 21, 2020

That's a good argument. Feel free to open a PR for this, if you want to :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants