Fix feed delta implementation.#831
Fix feed delta implementation.#831philwareham merged 1 commit intotextpattern:devfrom da2x:feature_delta_feeds
Conversation
New implementation supports returning feed deltas (just the new entries) if the A-IM plus either the If-Modified-Since or If-None-Match headers. * Always send a Vary header for feeds so caches will be variant aware. * Disable caching when Txp is not in production. * Don't lie about last modification dates. * Derive ETags from last modification timestamps.
|
Test instructions Tweak the date backward in time. The feed should only include entries modified/published after the datestamp. If no new entries are return, you should get no body message/feed and get a 304 response code. |
|
It seems we are with you at the same time fix the same piece of code. ;-) BTW, someone actually uses I absolutely do not see any reason to use it in such small amounts of data. ps: The current implementation of this ( |
No reason not to merge this now, is there? Incremental improvements and then you can sort out the conflicts in your branch rather than having me sort them out in mine. 😉 This patch does reduce the number of differences between the two implementations. I actually thought I’d try to combine them into
Clients: FeedHQ, Feed Notifier, Internet Explorer and Microsoft Outlook (Widows-RSS-Platform), Liferea, Miniflux, Newsblur, Newsbeuter, Vienna, and patches exist for even more. Most of them didn’t support it two weeks ago, but I’ve implemented it in all the still-maintained open source feed readers. Servers: Textpattern, ExpressionEngine, WordPress (with a plugin), and OpenFire.
Mobile and Australia (pay-per-MB). Also, feeds can be configured to include hundreds of entries and website that publishes hundreds of entries per day would need to increase the number of entries in their feeds. Podcasts traditionally include the last year or two of episodes in their feeds. Plus, with most cheap hosting solutions webadmins will be more restricted by bandwidth constrains than the extra microsecond it takes to get feed deltas right. Full-length feeds is a thing that can be enabled in settings. Give and take a few of these conditions, and you’ll start wishing more feed producers and clients supported delta feeds. |
|
Thanks, I've merged this so you can discuss between you best way to continue the improvements together. :) |
That was my miscalculation. I just watched the code and it turned out that I changed it. ;-)
I agree that these systems declare work with delta-feed. But how many of them can work out all the situation correctly? Test cases:
They do not work out. These test cases are applicable to other systems. There are many nuances (as well, and other plugins that these changes may affect) and more likely to make mistakes, because of which the loss of positions in the Feed Reader may occur. I would prefer reliable operation of the core system. Delta feed can be developed as a plugin, it will give more flexibility and greater speed of development. The plugin can already be put on existing sites, rather than wait for the next release of the core system. |
|
@Aeyoun function handle_lastmod() has been broken. This function is not only used for feed, so I would not change it so drastically. |
|
@makss, broken how? No one consumed that functions return values, and that is all I removed from it. The biggest change is that it now sets ETags as well as Last-Modified. It ensures compatibility with more clients, as not all clients implement If-Modified-Since (not all implement If-None-Match either, so that is why we still use both all over the web). It does the same job as before: it still takes care of signaling cache freshness. It still makes sure the body message is empty by killing the processing after sending a 304. Maybe I missed something, but I don’t believe that I broke it in any way. |
|
Technical problems:
Please test your own code. Logical problems:
|
I didn’t test with ancient versions of PHP, that is correct. Looks like explode can’t be used like an array before after PHP 5.4. PHP versions older than 5.6 is unsupported (and 5.6 only has a a year left of its life) and aren’t getting security updates. I’ll find a workaround for this issue, but in the meantime you should update your PHP version.
Now you’re just being unfair. There where hardly any comments there before. I’ll sprinkle over some more.
Ah. Good point. I’ll put the returns back. |
|
Actually, I retract the first one. I’ll not bother working around an issue in an insecure and already two-year unmaintained version of PHP. I can put in a warning about running ancient versions of PHP somewhere instead, if that is desired. |
|
The minimum PHP version for Textpattern is currently 5.3 so, although admittedly annoying, code should respect that. PHP 5.3 is still fairly widely used. |
Added to pull #832. |
New implementation supports returning feed deltas (just the new entries) if the A-IM plus either the If-Modified-Since or If-None-Match headers to abide by feed caching best practices.
Follow up from issue #811, obsoletes #826.