John J Lee <jj...@users.sourceforge.net> added the comment:

> Yes,it currently does not handle chained redirects via cache. I dont know 
> RFC's stance on it. RFC does not say anything about 301 chained redirects

I don't see anything in the RFC that prevents us caching chained 301 
redirections.  Caching the chained redirections is better, because it reduces 
the number of requests, which is the purpose of the cache.

> there are tricker issues of caching anything other than 301.

Antoine wasn't suggesting caching URLs from non-301 responses, just that you 
don't need to add a new method named "http_redirect_301".  Just delete it and 
test "if code == 301" in http_error_302.

> Basically, 302 and other require the client to check and comply with the 
> Cache-Control and Expires header.

I don't think references to caching in the descriptions of the 30* response 
codes are relevant, because urllib2 doesn't implement response caching.  I 
think the part that's relevant is this: "The requested resource has been 
assigned a new permanent URI and any future references to this resource SHOULD 
use one of the returned URIs."

> The global opener seems to be a straight forward way to for this activity and 
> not a harmful too.  I can't think of request-specific object for this one.

No.  The global OpenerDirector instance is a convenience to allow having a 
global urlopen() function.  Having a handler pick a random opener object (the 
global one) would be insane.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1755841>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to