I'm using the ETag header for caching and the browser sends a corresponding If-None-Match header. Initially, I simply compared these headers and it worked.
Later it occurred to me that rfc2616 allows a list of entities, so I fixed it. The question is, if the fix gets ever used...
- Does the browser ever issue a request with an
If-None-Matchheader containing more than one entity? - Are there any other real world uses?
There are two use cases that I can think of: union of browser and caching proxy entity-tags and custom client-side cache implemenation.
Although, I never seen browser serves request with multiple entity-tags in
If-None-Match, there are caching proxies that may have it's own version of a requested resource. They may replace value ofIf-None-Matchsent by browser with union of browser's resource version entity-tag and proxy resource version(s) entity-tag before sending request further to server. This way if proxy has fresh version of a requested resource you can reduce server load by serving full response (with body payload) from proxy instead of a server. This case is described by RFC 7234 Hypertext Transfer Protocol (HTTP/1.1): Caching:I can't say whether support of that part of RFC 7234 is wide, but certainly there are proxies that support it. Check Node.js Caching Reverse HTTP Proxy project by Colin Mollenhour.
On the other hand you may not want to rely on browser to perform conditional request. You can set
If-None-MatchHTTP header value by yourself usingXMLHttpRequest.setRequestHeader(). This can be useful if you store multiple versions of a resource using Web Storage API, Cache API or other mechanism. Server response must containETagHTTP header with entity-tag. This entity-tag indicates which version of a resource is considered fresh.