HTTP and optimistic concurrency

I was recently talking about optimistic and pessimistic concurrency. That got me thinking about one of the most popular protocols around: HTTP.

While HTTP doesn't refer to this in as many words, it does in fact have support for an optimistic concurrency system. This is based around entity tags, which are values that can be used to compare two or more entities or versions from the same resource. You can get one of these in the ETag header when you do a GET, and when you update something on the server, you can send an If-Match to make sure that it's still the same.

To keep things simple and flexible, the client doesn't really know what information the ETag encodes, it just keeps it around so it can send it back as-it-was to the server. So, the ETag is "opaque", and you can even use this to ask whether something was updated since you last saw it (a "conditional GET") and save yourself the trouble of reading the response if it's still the same.


Comments (1)

  1. check out this rather nice W3C document on the details of how to handle concurrency checks:…/Editing

Skip to main content