Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Give etag after a put #157

Open
sylvainlb opened this issue Jun 7, 2015 · 9 comments
Open

Give etag after a put #157

sylvainlb opened this issue Jun 7, 2015 · 9 comments
Assignees

Comments

@sylvainlb
Copy link

When you PUT a resource to the server, its etag is modified but not communicated to the client. That means that if the client wants to save a new version of the resource, it first needs to do an extra GET on it, although it already has it.

Shouldn't the server add the new etag as a header of the PUT response?

@bblfish
Copy link
Member

bblfish commented Jun 7, 2015

yes, I think I asked a question like that on the ldp mailing list. Mostly these should return the same headers as GET. But would be good to find the HTTP RFC that details that.

@sylvainlb
Copy link
Author

ok. I'll see if I can fix it myself

@sylvainlb sylvainlb self-assigned this Jun 7, 2015
@bblfish
Copy link
Member

bblfish commented Jun 7, 2015

Thanks, should be easy.

@sylvainlb
Copy link
Author

As I understand, PUT, PATCH and POST should return Access-Control-Allow-Origin, Accept-Patch, mimetype, then linkHeaders(ldpr) and the commonHeaders. Rigth?

@bblfish
Copy link
Member

bblfish commented Jun 9, 2015

I don't think in this case the order is important

@sylvainlb
Copy link
Author

Ok, but I was checking that my list was correct.

@bblfish
Copy link
Member

bblfish commented Jun 9, 2015

POST should definitely return the headers that the created document should return on a GET. For PUT and PATCH they should return the headers of the document that were changed. And yes, that seems to include Access-Control stuff and what patch formats the resource accepts.

@sylvainlb
Copy link
Author

Ok, I couldn't do it so far. I need an AuthResult to call the header functions, and all I have is an IdResult. I'm not sure if I could get the first from the latter or if I should call fullAuthInfo. I'll try to keep looking, but if you have a clue on how to get that AuthResult, it's welcome.

@bblfish bblfish added this to the Initial Server Deployment milestone Feb 12, 2016
@bblfish
Copy link
Member

bblfish commented Feb 20, 2016

The problem is that the put function returns an IdResult[Rdf#URI]. Further down the problem is that the putLDPR script returns returns Unit. You can see this by comparing with getLDPR, which returns an Rdf#Graph.

I don't think it really makes much sense to have commands that just return graphs. The metadata about the graphs, is so often important that I think the command structure needs to be simplfied for that.

Here the simple answer for the moment is to follow the put by a getMeta, and then use that information.
It would actually be easy to optimize the code so that this is very cheap. There are loads of examples of that in the tests.

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

No branches or pull requests

2 participants