I know the default is to send the Last-Modified HTTP header out as the time of request, and I can't really comment on that. But for RSS feeds, that date should be more representative of the content of the feed. The attached patch changes that date from the request time to the pubDate of the first, most recent, node in the feed. This will help services like Twitterfeed that rely on Last-Modified headers to check whether a feed has updated.

If this makes sense, I can do something similar for D8.

Comments

Status: Needs review » Needs work

The last submitted patch, rss_last_modified.patch, failed testing.

chellman’s picture

StatusFileSize
new732 bytes
chellman’s picture

Status: Needs work » Needs review
drasgardian’s picture

Status: Needs review » Needs work

It doesn't look like this will change the last-modified http header if a node is removed from the feed.

Perhaps this could be tied in with views caching. i.e. when serving a cached version of the feed set the last-modified header to the timestamp of when the cache was generated.

chellman’s picture

Status: Needs work » Needs review

Thanks for taking a look. This particular patch doesn't have anything to do with Views, but I'm curious about the other issue.

You're saying the feed's modified date should change if some other, earlier node is removed? I guess technically the feed has changed in that case, but at that point there still aren't any new nodes in the feed (if one is removed, it's replaced by an older one). Considering that this core RSS feed is generally pretty much just for syndicating new content, I don't know if updating the feed's date in that case really matters. I'm saying the feed's date should be the same as that of the newest node.

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.