anusorn / httplib2

Automatically exported from code.google.com/p/httplib2
0 stars 0 forks source link

Broken redirect chain: Response.previous always points to the initial response object #294

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set follow_redirects & follow_all_redirects to True
2. Make a request to a url with more then on level of redirection 
(http://t.co/8vHEwyXf8N, for example)
3. Attempt to follow the redirect chain backwards via response.previous

What is the expected output? What do you see instead?
Expected output: response.previous is the second to last response in the 
request chain
Actual output: response.previous is set to the first response in the request 
chain

What version of the product are you using? On what operating system?
httplib2 0.8 
OSX 10.8.4

Please provide any additional information below.

I think is a logical error caused @ __init__.py line 1368

Here, you're constantly overwriting the value of response.previous with 
old_repsonse when you really want to
follow the 'previous' chain all the way to the end and set the 'previous' 
attribute of the last Response object in chain to old_response.

I've got a patch in place. Once I've got a test in place, I'll submit my 
changes.

Original issue reported on code.google.com by sso...@gmail.com on 29 Aug 2013 at 7:20