CalDAV: Use If-Match: on PUT, unless explictly told not to use it
I create over CalDAV an event. Evolution injects it with PUT, Prefer: return=minimal, If-None-Match: *. The server retuns on PUT an Etag. I modify the event, by changing its COLOR and PUT it again on the server. Evolution does not utilize the If-Match
header, to make sure, that it has the latest version and is updating that latest version. It just overwrites unconditionally the content on the server.
When Evolution does PUT of event with Attendees, the server always inserts SCHEDULE-STATUS parameter to the attendees. So it modifies the object and on PUT with Prefer: return=minimal, it does not return an Etag. Then evolution calls a GET on the uploaded resource, to receive the Etag. This Etag is not used on subsequent PUTs, so there is no point on calling the GET.
- When overwriting the resources, send If-Match: with the known Etag. If it fails, offer the user to force-push the current object (PUT without If-Match), or to download the object from the server (possibly losing local changes).
As far as I remember, the If-Match was utilized in the past and in fact caused unquitable loop, stating that the local object is outdated.