NewsBlur
NewsBlur copied to clipboard
HTTP 308 treated as error instead of following redirect
HTTP 308 "Permanent Redirect" is subtly different from HTTP 301 "Moved Permanently", but both should result in a redirection in the case of fetching a feed. This was reported in the forums:
https://forum.newsblur.com/t/unable-to-connect-to-streetsblog-rss-feed/10090
The site settings dialog reports the errors as:
2023-12-29 13:56:30 HTTP Redirect (308)
2023-12-29 13:56:30 HTTP Redirect (10 to go) (308)
This seems to correspond to utils.feed_fetcher.ProcessFeed.verify_feed_integrity
, and indicates that the self.feed.count_redirects_in_history('feed')
call is not behaving as expected. In apps.rss_feeds.models.Feed.count_redirects_in_history
, it appears only status codes 301 and 302 are considered. A better set of tests might be,
... and 300 <= int(h['status_code']) < 400
... and not 300 <= int(h['status_code']) < 400
Or, if Python 3.12 is available:
import http
...
... and http.HTTPStatus(h['status_code']).is_redirection
... and not http.HTTPStatus(h['status_code']).is_redirection
https://docs.python.org/3/library/http.html#http-status-category
Related:
https://forum.newsblur.com/t/update-permanently-redirected-feeds-to-their-new-location/5681