On Jun 29, 2011, at 8:02 AM, Robert Newson wrote:

> This is deliberate ("COUCHDB-799 - More granular ETags for views." --
> "ETags for views now only change when their underlying view index
> changes due to indexing or purges. ETags are also specific to each
> view.")
> 
> The view is updated if and only if the emitted data actually changes.

Interesting. So the implication is that one shouldn’t combine the ?include_docs 
option with conditional GETs, because it won’t report changes in the document 
contents.

Unfortunately this means that CouchDB is now returning incorrect Etag: headers. 
This semantic change means that the view’s ETag is now a “weak validator”, 
since it may stay the same even though the literal response body changes. That 
means that it must be preceded with “W/“ according to the HTTP 1.1 spec.

So for example, I do this:

$ curl -I http://localhost:5984/demo-addresses/_all_docs
HTTP/1.1 200 OK
Server: CouchDB/1.2.0a-ed63a4d-git (Erlang OTP/R14B01)
Etag: "9XKYFE3OM8ZSWLNSEI4QPFB9L"
Date: Wed, 29 Jun 2011 18:10:49 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 0
Cache-Control: must-revalidate

The “Etag:” header should read
        Etag: W/"9XKYFE3OM8ZSWLNSEI4QPFB9L"

—Jens

Reply via email to