[issue1755841] Patch for [ 735515 ] urllib2 should cache 301 redir

Senthil Kumaran report at bugs.python.org
Mon Dec 28 15:56:19 CET 2009


Senthil Kumaran <orsenthil at gmail.com> added the comment:

> Antoine Pitrou added the Comment:
>                                                                      
                                               
> I have trouble understanding what the patch does. I would expect it to
> cache the <original URL> -> <redirected URL> mapping, but it seems   
> cache the final HTTP response instead.

Oops. My mistake. I got carried away by my misunderstanding of the RFC
section on 301. The patch is wrong. I coded it to cache the response
from the redirection instead of just the redirected URL.
I shall write the correct one to cache just the redirection.           
                                               
                                                                       
                                               
> Aren't http_error_301 and friends for internal use?
                                                                       
      
Not really. They are exposed methods and I believe are being used by
clients. There have been bug reports related those redirection         
methods. Even the related Issue735515, explains pretty clearly about
the redirection required. (My bad again and my comment in that issue
is irrelevant.) In this issue, John says that there is no obvious need
to change the interface.  

RFC had a statement along the lines that "301 redirection is cached by
default, unless indicated otherwise". This is where I thought, an option
to turn-off the cacheable behavior might be needed.
                                                   
Thanks for looking at this quickly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1755841>
_______________________________________


More information about the Python-bugs-list mailing list