classification
Title: urrlib2 max_redirections=0 disables redirects
Type: feature request Stage: test needed
Components: Library (Lib) Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ajaksu2, jjlee, orsenthil, rus_r_orange (4)
Priority: normal Keywords:

Created on 2006-07-11 22:16 by rus_r_orange, last changed 2009-02-13 02:08 by ajaksu2.

Messages (2)
msg60939 - (view) Author: rus_r_orange (rus_r_orange) Date: 2006-07-11 22:16
When using urllib2, I wanted to be able to see all
redirects that come back from an http server. I set the
variable max_redirections in HTTPRedirectHandler to 0.
However, redirects were still being followed because
the req didn't have a redirect_dict set.

IMHO, if max_redirections is set to 0, redirects should
not be followed, no matter what. 

For my personal situation, I copied urllib2 and hacked
it to that if max_redirections is 0 (or less), it will
always raise the HTTPError that is associated with the
status code received by the request.

I saw this issue on WinXP with 2.4.1 and on Linux with
2.4.3.
msg81785 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-12 17:39
rus_r_orange: Can you share your patch and tests?
History
Date User Action Args
2009-02-13 02:08:47ajaksu2setnosy: + jjlee
2009-02-12 17:39:44ajaksu2setnosy: + ajaksu2, orsenthil
stage: test needed
messages: + msg81785
versions: + Python 2.7
2006-07-11 22:16:22rus_r_orangecreate