https://bz.apache.org/bugzilla/show_bug.cgi?id=70310

            Bug ID: 70310
           Summary: If-Modified-Since not ignored next to a matching
                    If-None-Match; If-Unmodified-Since not ignored next to
                    If-Match (RFC 9110 §13.1.3, §13.1.4)
           Product: Apache httpd-2
           Version: 2.4.66
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

ap_meets_conditions() lets every conditional header veto the result.
RFC 9110 requires two of them to be ignored:

  13.1.3: "A recipient MUST ignore If-Modified-Since if the request
  contains an If-None-Match header field"
  13.1.4: "A recipient MUST ignore If-Unmodified-Since if the request
  contains an If-Match header field"

1. If-None-Match matches the current ETag and If-Modified-Since is older
   than Last-Modified: httpd answers 200, expected 304 (13.2.2, step 3).
2. "If-Match: *" and an If-Unmodified-Since older than Last-Modified:
   httpd answers 412, expected 200. A request is refused, which matters
   most for methods that change state.

Both happen with a default static-file configuration (attached).

Item 1 is the case of bug 46306, fixed in 2011 for 2.2 and 2.3. That bug
asked for 200 here, as RFC 2616 13.3.4 then required (no 304 unless
consistent with all conditional headers). RFC 7232 3.3 (2014) replaced
that rule with the one above, and RFC 9110 keeps it, so this asks httpd to
follow the current rule. Item 2 is not covered by 46306.

Steps (index.html has Last-Modified: Wed, 01 Jan 2020 00:00:00 GMT):

  URL=http://127.0.0.1:8081/index.html
  ETAG=$(curl -sI $URL | sed -n 's/^ETag: //Ip' | tr -d '\r')
  curl -si -H "If-None-Match: $ETAG" \
       -H 'If-Modified-Since: Fri, 01 Jan 2010 00:00:00 GMT' $URL | head -1
  curl -si -H 'If-Match: *' \
       -H 'If-Unmodified-Since: Sat, 01 Jan 2000 00:00:00 GMT' $URL | head -1

Results (the last four rows are controls: each header alone):

  request                          expected   actual
  INM + IMS (2010)                 304        200
  If-Match * + IUS (2000)          200        412
  INM alone                        304        304
  IMS (2010) alone                 200        200
  If-Match * alone                 200        200
  IUS (2000) alone                 412        412

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to