jsumners / jsumners/feedparser
unmodified redirected feed returns status 302 instead of 304
Open
Nobody has claimed this yet.
auto-migrated
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
If you try to fetch a feed that is redirected to another URL, and then the feed
has not been modified such that the redirected request returns status 304, the
result returned by parse has status set to 302 when it should be set to 304 to
make it clear to the caller that the feed is not modified.
Otherwise, the caller can't distinguish this from a redirected request that
produces an incorrect, empty response. Well, at least, not without doing
pattern matching against result.debug_message, which I'm sure you don't intend.
The fix is trivial:
--- feedparser.py 2013/02/13 02:38:25 1.1
+++ feedparser.py 2013/02/13 02:38:45
@@ -3959,6 +3959,7 @@
# Stop processing if the server sent HTTP 304 Not Modified.
if getattr(f, 'code', 0) == 304:
+ result['status'] = 304
result['version'] = u''
result['debug_message'] = 'The feed has not changed since you last checked, ' + \
'so the server sent no data. This is a feature, not a bug!'
Original issue reported on code.google.com by jikam...@gmail.com on 13 Feb 2013 at 2:39
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies feedparser.py and the HTTP 304 handling branch. Read that branch and the surrounding redirect processing first; done means an unmodified redirected feed reports status 304 while preserving the existing debug message and version behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100