I discovered that my WordPress sends wrong Last-Modified (and consequently also wrong Etag) headers in the response for comment RSS feeds (request URL: http://site.tld/blog/?feed=comments-rss2). The Last-Modifed time WP returns is the last-modified time of the posts instead of that of the comments. As a consequence new comments appear only after a new post in RSS readers that use Last-Modified or Etag in the requests. This is very annoying.
I have looked at the WP code (wp-includes/classes.php line 1595) and found that WP uses the time of the last comments for the Last-Modified timestamp only if ‘withcomments=1’ is present in the URL or if ‘withoutcomments’ is not set and one of the parameters ‘name’, ‘page_id’, ‘pagename’, ‘attachement’, or ‘attachement_id’ is present at the same time. If that is not the case, the time of the last post is used for the Last-Modifed header.
When I change the feed URL to http://site.tld/blog/?feed=comments-rss2&withcomments=1 the correct Last-Modified date is returned. To me this looks like a bug. Either the if statement in wp-includes/classes.php at line 1595 is wrong or the parameter ‘withcomments=1’ is missing in the RSS feed URL.
Can you confirm this bug, or correct me if I am wrong?
PS: I’m referring to WordPress 2.8.4.
- The topic ‘Wrong Last-Modified HTTP response header for comment RSS feed (a bug?)’ is closed to new replies.