-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix PUTing documents with If-None-Match when non-existent #104
base: master
Are you sure you want to change the base?
Conversation
Yeah, I thought that was odd when I saw that code, but I didn't explore further. It appear to assume only one of those will be used with a given verb. |
It seems we have tests that storage.js passes arguments to the store, but not tests that the store properly handles If-Match and If-None-Match. So I've added some, in branch https://github.com/remotestorage/armadietto/tree/test-if-none-match If you pull that branch and go back to commit 17a7cf7 , you can see our existing code handles If-Match with an ETag and If-None-Match with *. It doesn't handle If-None-Match with an ETag, as the signature for the put method doesn't allow put to distinguish If-Match with an ETag vs. If-None-Match with an ETag, as @raucao noted. Unfortunately, the tests show commit b578ded fixes If-None-Match with an ETag, at the expense of If-Match with an ETag and If-None-Match with *. and a number of other tests as well. There will need to be some changes before we can merge this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we have tests that storage.js passes arguments to the store, but not tests that the store properly handles If-Match and If-None-Match. So I've added some, in branch https://github.com/remotestorage/armadietto/tree/test-if-none-match
If you pull that branch and go back to commit 17a7cf7 , you can see our existing code handles If-Match with an ETag and If-None-Match with *. It doesn't handle If-None-Match with an ETag, as the signature for the put method doesn't allow the method to distinguish If-Match with an ETag vs. If-None-Match with an ETag.
Unfortunately, the tests show commit b578ded fixes If-None-Match with an ETag, at the expense of If-Match with an ETag and If-None-Match with *. and a number of other tests as well.
There will need to be some changes before we can merge this.
Just a friendly FYI that this bug still exists (AFAIK), and prevents However, I have no intention of adding more commits to this PR, since I'm the maintainer of a different server implementation myself (Liquor Cabinet + Akkounts), and I have no free capacity to get more familiar with the codebase here. |
This is fixed in the modular server; can we close this PR in favor of that? |
I found a pretty glaring bug when I tried to restore documents via rs-backup for development on my local machine:
The code currently does not discern between
If-Match
andIf-None-Match
in both the GET and PUT functions. It will just grab whichever header is set as the "version" and treat both headers the same way. When restoring a backup, and thus sending an ETAG inIf-None-Match
for a non-existent document (i.e. "create or update this document if there isn't one that matches this ETAG"), Armadietto will thus respond with a 412 conflict status.This changeset fixes the bug, but I have not looked at the tests for it. I would appreciate if a more regular contributor could add the respective tests, since I currently don't have more time to spend on this. Thank you.