urllib / urllib2 should cache the results of 301 (permanent) redirections. This shouldn't break anything, since it's just an internal optimisation from one point of view -- but it's also what the RFC (2616, section 10.3.2, first para) says SHOULD happen.
Hi gbrandll/jjlee, I am trying to understand the actual requirements here. Should the original url be avaiable to the user upon request as urllib automatically calls the redirect_request and provides the redirected url only? Please provide some details on this bug. I shall try to write a patch. Thanks, Senthil
In what respect? I just meant that it would be nice (and more compliant with the RFC) if rather than fetching the original URL each time, a map of URLs to 301-redirected URLs was kept. For urllib2, I suppose the map would be a private attribute of HTTPRedirectHandler. There's no obvious need to provide any interface to get the intermediate URLs in the redirection chain.