reassign 738102 feedparser
retitle 738102 wrong status code after redirection
tag 738102 + patch
thanks

Hi,

It seems to be a feedparser bug, reassigning accordingly. When a 302
redirects to a 304, the caller just sees the 302.

This bug is tracked upstream at

https://code.google.com/p/feedparser/issues/detail?id=390

Until a solution is accepted upstream I'll patch feedparser to return
the 304 to the caller.

Thanks!

-- 
Etienne Millon
Subject: Fix status reported for redirections
From: [email protected]
Bug: https://code.google.com/p/feedparser/issues/detail?id=390
Bug-Debian: http://bugs.debian.org/738102
Reviewed-by: Etienne Millon <[email protected]>

--- a/feedparser/feedparser.py
+++ b/feedparser/feedparser.py
@@ -3971,6 +3971,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!'
--- a/feedparser/feedparsertest.py
+++ b/feedparser/feedparsertest.py
@@ -523,7 +523,7 @@
         u = 'http://localhost:8097/tests/http/http_redirect_to_304.xml'
         f = feedparser.parse(u)
         self.assertTrue(f.bozo == 0)
-        self.assertTrue(f.status == 302)
+        self.assertTrue(f.status == 304)
 
 class TestDateParsers(unittest.TestCase):
     "Test the various date parsers; most of the test cases are constructed " \

Attachment: signature.asc
Description: Digital signature

Reply via email to