I want my 304

Wing posted about an issue with our ETag implementation in our Abdera Atom server implementation and XHR in Firefox:
Unfortunately, when you make a XMLHttpRequest in Firefox (allowing you to make a HTTP request without refreshing the page) and the return status set by the web server is 304, the XMLHttpRequest.status property is set to 200. In most cases this is fine because it doesn’t matter whether the page came from a webserver or from the local cache – in either case, the content is available for use.

In our case we want to be able to query our server about a particular entity and only take additional action running some SPARQL queries) if the status code is 200. When our server returns a 304, we won’t do anything. But since Firefox only gives a 200 in this case, we’ve had to add a custom HTTP header.

What is up with this? Wing filed a bug report and he has gotten a few responses already. However, there was one from Darin Fisher at Google that caught my attention:
yeah, the current behavior is valid. it’s not a bug that you can’t know when the item was taken from the cache vs. being fetched over the network. at most, this is a feature request, which should be taken up with the w3c
Any HTTP/REST/AJAX experts that would like to chime in the discussion? Is the current behavior valid or not?

About this entry