Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-2940

ETag If-None-Match comparison must be weak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • 1.7.0, 2.0.1
    • None
    • None

    Description

      When a request is received with a If-None-Match header, the ETag comparison must be weak, according to RFC7232 § 3.2: (emphasis original)

      A recipient MUST use the weak comparison function when comparing entity-tags for If-None-Match (Section 2.3.2), since weak entity-tags can be used for cache validation even if there have been changes to the representation data.

      Earlier § 2.3.2 gives a helpful table for the differences between strong and weak validation:

      The example below shows the results for a set of entity-tag pairs and
      both the weak and strong comparison function results:
      
      +--------+--------+-------------------+-----------------+
      | ETag 1 | ETag 2 | Strong Comparison | Weak Comparison |
      +--------+--------+-------------------+-----------------+
      | W/"1"  | W/"1"  | no match          | match           |
      | W/"1"  | W/"2"  | no match          | no match        |
      | W/"1"  | "1"    | no match          | match           |
      | "1"    | "1"    | match             | match           |
      +--------+--------+-------------------+-----------------+
      

      CouchDB currently uses strong comparison, even for If-None-Match.

      $ curl -vo /dev/null http://couchdb.local/db/document1 -H'If-None-Match:"8FTYH1N3L0TPD7ZEZCPW16J4T"'
      
      […snip…]
      
      < HTTP/1.1 304 Not Modified
      < Server: CouchDB/1.6.1 (Erlang OTP/18)
      < ETag: "8FTYH1N3L0TPD7ZEZCPW16J4T"
      < Date: Tue, 26 Jan 2016 19:47:46 GMT
      < Content-Length: 0
      
      $ curl -vo /dev/null http://couchdb.local/db/document1 -H'If-None-Match:W/"8FTYH1N3L0TPD7ZEZCPW16J4T"'
      
      […snip…]
      
      < HTTP/1.1 200 OK
      < Vary: Accept
      < Server: CouchDB/1.6.1 (Erlang OTP/18)
      < Etag: "8FTYH1N3L0TPD7ZEZCPW16J4T"
      < Date: Tue, 26 Jan 2016 19:49:25 GMT
      < Content-Type: application/json
      < Content-Length: 1449
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            terinjokes Terin Stock
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: