This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tkel
Recipients brian.curtin, tkel
Date 2011-12-22.18:41:26
SpamBayes Score 1.336151e-05
Marked as misclassified No
Message-id <1324579286.85.0.696694544221.issue13651@psf.upfronthosting.co.za>
In-reply-to
Content
I created this patch to further the functionality of redirection using the "location" header in the HTTPRedirectHandler class under urllib/request.py

Currently, the method http_error_302, which will handle code 302 redirection will parse the location header and build a Request accordingly. I encountered a website that only returned "index.php" as the Location header. When http_error_302 called on urlparse, it returned the following tuple: ParseResult(scheme='', netloc='', path='index.php', params='', query='', fragment='')

Then, http_error_302 will check if the scheme is equal to either http, https, or ftp. This is the part I changed in the patch. If it does not pass, an exception is thrown.

Afterwards, http_error_302 builds the target url. As long as the url passes the scheme check, the program will succeed.
History
Date User Action Args
2011-12-22 18:41:26tkelsetrecipients: + tkel, brian.curtin
2011-12-22 18:41:26tkelsetmessageid: <1324579286.85.0.696694544221.issue13651@psf.upfronthosting.co.za>
2011-12-22 18:41:26tkellinkissue13651 messages
2011-12-22 18:41:26tkelcreate