[Patches] [ python-Patches-1755841 ] Patch for [ 735515 ] urllib2 should cache 301 redir

SourceForge.net noreply at sourceforge.net
Tue Jul 24 05:56:40 CEST 2007


Patches item #1755841, was opened at 2007-07-18 08:02
Message generated for change (Comment added) made by orsenthil
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1755841&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: O.R.Senthil Kumaran (orsenthil)
Assigned to: Nobody/Anonymous (nobody)
Summary: Patch for [ 735515 ] urllib2 should cache 301 redir

Initial Comment:
Tracker item python.org/sf/735515 mentions about urllib2 to cache 301 redirections.
Attached patch tries to implement the same.

Comments on Version 1 of patch:
a) Initializes a dictionary to store the redirection.
b) If req already in cache, return the previous Request object.
c) Otherwise handle the same as 302 and store the Request object.
d) Checks for loop errors in 301.

Just noticed, that it I missed max-redirect checks.
Please comment on this patch, with next version I shall add the max redirect check.



----------------------------------------------------------------------

>Comment By: O.R.Senthil Kumaran (orsenthil)
Date: 2007-07-24 09:26

Message:
Logged In: YES 
user_id=942711
Originator: YES

I have made some changes to patch. Made it use just the self.cache to
cache and follow the same logic for redirect and loop as 302 would follow.
I thought this is ok. Did a basic testing to verify if it caught 301
redirect, yes it does.

File Added: urllib2-cache-301.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1755841&group_id=5470


More information about the Patches mailing list