Shopify/cacheable — pull request #6 by hornairs (2013-03-13 22:52:58+00:00)
Title: Don't send ETags to IEs making XHRs.

As seen by myself and Nick and Lydia, Internet Explorer will lie, and
serve a 304 modified ajax request, without actually visiting the server
to see if it hasn't in fact been modified. All versions, all the time.
See http://www.dashbay.com/2011/05/internet-explorer-caches-ajax/ .

To avoid this problem of javascript clients getting back total bullshit
responses even though the server side representation has changed and the
server would serve a new one if asked, we detect internet explorer
asking for an ajax request, and specifically opt out of caching by
sending the "Expires: -1" header. Lame. The manner in which we detect
the situation isn't bulletproof but I think will be good enough: we use
user agent detection to find internet explorer, and then rely on the
fact that most javascript libraries set the "X-Requested-With" header to
"XmlHttpRequest" in order to let the server know. Libraries have
standardized on this value. For the crazies who aren't sending this
header (and thus not using jQuery, Prototype, Mootools, or Dojo, or
anything on top of those frameworks), we also look to see if the browser
has sent an Accept header of "application/json", which is what the
majority of AJAX requests to shopify that Cacheable is active on might
ask for.

Phew.

@boourns @camilo @nickjs for review please.

/cc @lkrupphunter