[Cosmo-dev] etag change

Brian Moseley bcm at osafoundation.org
Wed Apr 18 17:32:50 PDT 2007


i just checked in a change to how we calculate etags for our http resources.

the old form of an etag was: <content-length>-<last-modified-timestamp>

the new form is: <uuid>:<last-modified-timestamp> with the whole thing
encoded with sha1+base64.

the new etags can be generated for any kind of item, including
collections, which is useful for saving bandwidth on feed requests
(and battery life, if the feed client is on a mobile device).

the old etags were not actually unique, in that the same etag could be
generated for two resources with the same content length that were
modified at the same millisecond. that's usually okay, but we're safer
basing on uuid. also, the old etags didn't work for collections, which
don't have content.

the encoding of the etag is just thrown in for obfuscation. we could
remove it if having the etag in raw format is extremely useful for
some troubleshooting reason. however, i like having it obfuscated,
because as per spec, clients shouldn't count on any particular etag
generation algorithm from a server.

the new etags are not compatible with the old ones. this will manifest
itself the first time somebody uses the desktop to sync with dav a
previously published collection. it will think that every item in the
collection has changed and will re-download every item. morgen, can
you confirm that this won't cause any data corruption problems?


More information about the cosmo-dev mailing list