Title: urllib / urllib2 should cache 301 redirections
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: Patch for [ 735515 ] urllib2 should cache 301 redir
View: 1755841
Assigned To: orsenthil Nosy List: ajaksu2, georg.brandl, jjlee, orsenthil, vila
Priority: normal Keywords:

Created on 2003-05-10 00:21 by jjlee, last changed 2009-12-28 15:38 by pitrou. This issue is now closed.

Messages (5)
msg53878 - (view) Author: John J Lee (jjlee) Date: 2003-05-10 00:21
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. 
msg53879 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2007-07-06 13:27
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.

msg61278 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-20 12:21
John, what did you have in mind?
msg61313 - (view) Author: John J Lee (jjlee) Date: 2008-01-20 17:32
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

There's no obvious need to provide any interface to get the intermediate
URLs in the redirection chain.
msg86706 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2009-04-27 22:41
Patch in issue 1755841.
Date User Action Args
2009-12-28 15:38:15pitrousetstatus: open -> closed
resolution: duplicate
dependencies: - Patch for [ 735515 ] urllib2 should cache 301 redir
superseder: Patch for [ 735515 ] urllib2 should cache 301 redir
2009-08-21 01:22:12orsenthilsetassignee: orsenthil
2009-04-27 22:41:38ajaksu2setversions: + Python 2.7
nosy: + ajaksu2

messages: + msg86706

dependencies: + Patch for [ 735515 ] urllib2 should cache 301 redir
2008-01-20 17:32:42jjleesetmessages: + msg61313
2008-01-20 12:21:11georg.brandlsetnosy: + georg.brandl
messages: + msg61278
2008-01-05 13:07:33vilasetnosy: + vila
2003-05-10 00:21:26jjleecreate