Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 308 treated as error instead of following redirect #1841

Open
ahills opened this issue Dec 29, 2023 · 0 comments
Open

HTTP 308 treated as error instead of following redirect #1841

ahills opened this issue Dec 29, 2023 · 0 comments

Comments

@ahills
Copy link

ahills commented Dec 29, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant