In bootstrap.inc last modified headers check`s by strongest condition.
If-Modified-Since and etag headers MUST exist. And If-Modified-Since header MUST be equal to last modified ($cache->created) date.

Search engines unable to use conditional GET with such implementation which delays site recrawling speed.

See the https://tools.ietf.org/html/rfc7232#section-3.3

A recipient MUST ignore If-Modified-Since if the request contains an
If-None-Match header
field; the condition in If-None-Match is
considered to be a more accurate replacement for the condition in
If-Modified-Since, and the two are only combined for the sake of
interoperating with older intermediaries that might not implement
If-None-Match.

But https://tools.ietf.org/html/rfc2616##section-13.3.4 says

An HTTP/1.1 origin server, upon receiving a conditional request that
includes both a Last-Modified date (e.g., in an If-Modified-Since or
If-Unmodified-Since header field) and one or more entity tags (e.g.,
in an If-Match, If-None-Match, or If-Range header field) as cache
validators, MUST NOT return a response status of 304 (Not Modified)
unless doing so is consistent with all of the conditional header
fields in the request.

I try to use new logic for checking content modified or not.

With this patch search engines can correctly use conditional GET queries with Last Modified and get 304 Not Modified response. This increases recrawling speed of sites with many pages.

We solved the same problem for Drupal 8 with a contrib https://www.drupal.org/project/lastmodified_since

Comments

armrus created an issue. See original summary.

armrus’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3055984-last-modified-headers-fix-2.patch, failed testing. View results

armrus’s picture

StatusFileSize
new2.67 KB

Fix tests with new criterias.

sin’s picture

Title: Last mofified headers not implemented by RFC2616 and RFC 7232 » Last Modified headers not implemented by RFC2616 and RFC7232
Issue summary: View changes
Status: Needs work » Needs review

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.