tags:

views:

214

answers:

3

Do you know of any practical use of If-Unmodified-Since in the wild? From the description, it appears that this header was meant to help with avoiding dirty writes. i.e. update this resource only if it hasn't been modified since the last-modified-time available with client. Unlike If-Modified-Since, it doesn't seem to help with caching. Am I missing something?

+7  A: 

You can use it e.g. for a range request.
example: your client requests the resource http://examp.le/foo?id=3 and the Contents-length is 4096 but your client only requests the first 1024 bytes. It can then (at a later time) request the remaining 3072 bytes but that doesn't make sense if the resource has changed meanwhile.

edit: Also you might not want to change/update data if the resource has changed meanwhile. E.g. you request a customer record and edit something. If someone else has changed the record in the meantime this might lead to inconsistencies. Therefore send your updates with an if-unmodified-since(-I-retrieved-the-data) header and the webserver will/should reject your updates if the record has already been changed - your client can then request the "conflicting" data.

edit2: since you've asked for "any practical use of If-Unmodified-Since in the wild": see http://msdn.microsoft.com/en-us/library/dd179371.aspx#Subheading1.
Let's assume you've first requested the Blob properties. Now you know e.g. the Content-type and Content-length (maybe you need this for some kind of allocation). Someone/something might change the blob before you send the second, Get Blob request. If you send the value of Last-Modified as value of the If-Unmodified-Since header the server will respond with the appropriate error code if the blob has changed.

VolkerK
My first though was just "concurrency control". Good catch about the range requests!
rix0rrr
A: 

Say you are developing an application that shows local weather for a given place. If the server only updates the weather info only 'x' times a day, the browser can take care not to make a http request within that time frame (even if there is a refresh).

Sesh
A: 

It's useful when resuming large downloads.

Hans Malherbe