jcoglan / restore

Simple remoteStorage server written in Node.js
293 stars 27 forks source link

Expose ETags of folders #6

Closed agrueneberg closed 10 years ago

agrueneberg commented 11 years ago

draft-dejong-remotestorage-01 is not very explicit about returning ETags for folders, but it has a couple of paragraphs that can be interpreted that way, such as "All successful requests MUST return an 'ETag' header [HTTP] with, in the case of GET, the current version." Since you are storing and updating version information for folders anyway, why not expose them?

agrueneberg commented 11 years ago

Let me answer my question myself: when a document is deleted in the current implementation, the parent folder will take on the most recent modification time from one of its children rather than creating a new one. By exposing the ETags of folders, this pull request might therefore mess up browser caches.

The spec just says "A successful DELETE request to a document MUST result in [...] the version of its parent folder being updated, as well as that of further ancestor folders." To me this looks like something we would have to fix in a separate pull request. What is your opinion?

jcoglan commented 10 years ago

Has this requirement been clarified at all in the spec? I don't want to add behaviour that's not explicitly mandated and required by clients.

xMartin commented 10 years ago

@michielbdejong

michielbdejong commented 10 years ago

@jcoglan it's better (more efficient) to add an ETag header. i thought about how to do this, and i think the easiest solution would be to generate one from the JSON string that is sent as the body - just take its SHA1. this takes a little bit of computing power on the server, but saves network and computing power on the client